StratoDem / pandas-js

Pandas in JavaScript for data analysis and visualization
https://stratodem.github.io/pandas.js-docs
MIT License
458 stars 36 forks source link

Converting to JSON does not work #58

Open geyang opened 5 years ago

geyang commented 5 years ago

The example doesn't work. Is this library still maintained or used?

➜  ml-dash-client git:(master) ✗ node
> const pd = require('pandas-js')
> const Immutable = require('immutable')
> df = new pd.DataFrame(Immutable.Map({x: new pd.Series([0, 1]), y: new pd.Series([2, 2.3])}))
DataFrame {
  _data: Map { "x": 0   0
1   1
Name: , dtype: dtype(int), "y": 0   2
1   2.3
Name: , dtype: dtype(float) },
  _axes: {},
  _AXIS_ORDERS: List [ 0, 1 ],
  _values: null,
  _AXIS_LEN: 2 }
> df
DataFrame {
  _data: Map { "x": 0   0
1   1
Name: , dtype: dtype(int), "y": 0   2
1   2.3
Name: , dtype: dtype(float) },
  _axes: {},
  _AXIS_ORDERS: List [ 0, 1 ],
  _values: null,
  _AXIS_LEN: 2 }
> df.columns
undefined
> df.to_json({orient: "records"})
TypeError: Cannot read property 'map' of undefined
    at DataFrame.get (/Users/ge/machine_learning/berkeley-playground/packages/ml_logger/ml-dash-client/node_modules/pandas-js/dist/core/frame.js:862:92)
    at DataFrame.get (/Users/ge/machine_learning/berkeley-playground/packages/ml_logger/ml-dash-client/node_modules/pandas-js/dist/core/frame.js:811:36)
    at DataFrame.to_json (/Users/ge/machine_learning/berkeley-playground/packages/ml_logger/ml-dash-client/node_modules/pandas-js/dist/core/frame.js:447:23)
>