Open
Description
Problem
Today, when an IDataView
is created using TextLoader
, there's no need to create classes that define the schema.
var cols = new []
{
new TextLoader.Column(name: "Text",dataKind:DataKind.String,index:47),
new TextLoader.Column(
name: "Categorical",
dataKind: DataKind.String,
source: new TextLoader.Range[] {
new TextLoader.Range(19),
new TextLoader.Range(20),
new TextLoader.Range(21),
new TextLoader.Range(50),
new TextLoader.Range(59),
new TextLoader.Range(71),
new TextLoader.Range(83)}),
new TextLoader.Column(name:"Label",dataKind:DataKind.String,2)
};
var dataLoader = ctx.Data.CreateTextLoader(columns:cols);
var idv = dataLoader.Load(path);
However, if I want to export the IDataView
as an IEnumerable
, I can't because I need to explicitly provide the type of IEnumerable<T>
. If no classes have been created, I now need to go and create a new class just to export to an IEnumerable
.
Proposed solution
Just like LoadFromEnumerable
is able to infer and create an IDataView from IEnumerable<T>
, CreateEnumerable
should be able to infer T
based on the DataView schema or bind to an object at runtime using dynamic
.
ctx.Data.CreateEnumerable(idv,reuseRowObject:false,ignoreMissingColumns:false)
or
ctx.Data.CreateEnumerable<dynamic>(idv,reuseRowObject:false,ignoreMissingColumns:false)