Gmousse / dataframe-js

No Maintenance Intended
https://gmousse.gitbooks.io/dataframe-js/
MIT License
460 stars 38 forks source link

has the csv file been loaded successfully? #119

Closed feiyu-london closed 3 years ago

feiyu-london commented 3 years ago

Hi, Many thanks for this package. It offers many key features for handling data frame. I have tested the following to test dataframe-js.


const DataFrame = require('dataframe-js').DataFrame;

var ea_entries = []; var ea_header = []; var ea = new DataFrame(ea_entries, ea_header); DataFrame.fromCSV('/Users/feiyu/Documents/JS/eatest.csv').then(ea => ea.show());

console.log (ea); ea.toCSV(true,'/Users/feiyu/Documents/JS/eatestjsoutput.csv')

when reading csv, the terminal shows the data row by row, so it seems that reading csv has been successful, i.e. all entries in csv have been stored in variable ea.

However, when I try to write the variable ea into a csv file, I find the csv file is empty. Console.log (ea) also shows a couple of empty arrays.

I am a bit confused here. Has the csv file been loaded successfully? Did I miss out anything obvious? Many thanks.

Happy New Year!

Regards,

Fei Yu from London

feiyu-london commented 3 years ago

Hi, I think I have solved the problem myself by reading into #50.

The comment in #50, i.e. 'However you can access your DataFrame in a .then:', is a great solution. I basically need to write all related operations inside .then though it is a bit long. I have tested .toCSV and it has been successful! Many thanks. :)