DataFrame.fromRawCsv constructor
- String rawContent, {
- String fieldDelimiter = defaultFieldDelimiter,
- String textDelimiter = defaultTextDelimiter,
- String? textEndDelimiter,
- String eol = '\n',
- bool headerExists = true,
- Iterable<
String> header = const [], - String autoHeaderPrefix = defaultHeaderPrefix,
- Iterable<
int> columns = const [], - Iterable<
String> columnNames = const [],
Creates a dataframe instance from stringified csv rawContent.
final rawContent =
'column_1,column_2,column_3\n' +
'100,200,300\n' +
'400,500,600\n' +
'700,800,900\n';
final dataframe = DataFrame.fromRawCsv(rawContent);
print(dataframe.header); // (column_1, column_2, column_3)
print(dataframe.rows); // ((100,200,300), (400,500,600), (700,800,900))
print(dataframe.series.elementAt(0).data); // (100, 400, 700)
print(dataframe.series.elementAt(1).data); // (200, 500, 600)
print(dataframe.series.elementAt(2).data); // (300, 600, 900)
fieldDelimiter A delimiter which divides elements in a single row,
, by default
textDelimiter A delimiter which allows to use fieldDelimiter character
inside a cell of the resulting table, e.g. fieldDelimiter is ,,
textDelimiter is ", and that means that every , symbol in rawContent
which is not a field delimiter must be wrapped with "-symbol
eol The end of line character, \n by default
headerExists Whether the rawContent has a header line (list of column
titles) or not
header A custom header line for a resulting csv table (if
headerExists is false)
autoHeaderPrefix If there is no header line in the rawContent and
no header provided, autoHeaderPrefix will be used as a prefix for
autogenerated column titles
columns A collection of column indices that specifies which columns
should be extracted from the raw data and placed in the resulting DataFrame.
Has a higher precedence than columnNames
columnNames A collection of column titles that specifies which columns
should be extracted from the raw data and placed in the resulting
DataFrame. It's also can be used with auto-generated column names.
The argument will be omitted if columns is provided
Implementation
factory DataFrame.fromRawCsv(
String rawContent, {
String fieldDelimiter = defaultFieldDelimiter,
String textDelimiter = defaultTextDelimiter,
String? textEndDelimiter,
String eol = '\n',
bool headerExists = true,
Iterable<String> header = const [],
String autoHeaderPrefix = defaultHeaderPrefix,
Iterable<int> columns = const [],
Iterable<String> columnNames = const [],
}) =>
fromRawCsv(
rawContent,
fieldDelimiter: fieldDelimiter,
textDelimiter: textDelimiter,
textEndDelimiter: textEndDelimiter,
eol: eol,
headerExists: headerExists,
header: header,
autoHeaderPrefix: autoHeaderPrefix,
columns: columns,
columnNames: columnNames,
);