Skip to content

Commit

Permalink
Merge pull request #443 from dcrescim/read-csv-fix
Browse files Browse the repository at this point in the history
Fix for readCSV mismatch between Browser and Node
  • Loading branch information
risenW authored Apr 20, 2022
2 parents 0f85cae + f6afd8d commit 39c5103
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/danfojs-base/io/browser/io.csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const $readCSV = async (file: any, options?: CsvInputOptionsBrowser): Promise<Da
Papa.parse(file, {
header: true,
dynamicTyping: true,
skipEmptyLines: 'greedy',
...options,
download: true,
complete: results => {
Expand Down
3 changes: 2 additions & 1 deletion src/danfojs-base/io/node/io.csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ const $readCSV = async (filePath: string, options?: CsvInputOptionsNode): Promis
const optionsWithDefaults = {
header: true,
dynamicTyping: true,
skipEmptyLines: 'greedy',
...options,
}

const dataStream = request.get(filePath);
const parseStream: any = Papa.parse(Papa.NODE_STREAM_INPUT, optionsWithDefaults);
const parseStream: any = Papa.parse(Papa.NODE_STREAM_INPUT, optionsWithDefaults as any);
dataStream.pipe(parseStream);

const data: any = [];
Expand Down

0 comments on commit 39c5103

Please sign in to comment.