waTeim / node-julia

Fast and simple access to Julia embedded in node
MIT License
80 stars 15 forks source link

Undefined names for Data Frame #28

Open justinian336 opened 8 years ago

justinian336 commented 8 years ago

I'm using node-julia to import a csv file into a dataframe in the following way:

julia.eval("using DataFrames");
julia.eval("using GLM");
julia.eval('df = readtable("./app/uploads/'+req.body.fileName+'")');

If I use df to estimate a linear regression employing GLM, it works well, and I can call the variables by their column names. However, if I try julia.eval("names(df)"), I get undefined! When printing df to the console, this is what I get (see that names:undefined):

JRef {
  colindex: 
   JRef {
     lookup: 
      JRef {
        count: 22,
        dirty: true,
        idxfloor: 1,
        keys: undefined,
        ndel: 0,
        slots: <Buffer 01 00 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00 00 00 01 00 01 01 00 01 01 00 00 00 00 01 00 00 00 00 00 01 01 00 00 00 00 01 01 01 01 01 00 00 00 ... >,
        vals: [Object] },
     names: undefined },
  columns: undefined }

Importing the file in the exact same way using Julia outside Node actually gives me column names when using names(df), so I believe it's an issue with node-julia, rather than with the dataset. Any hint on what's happening?