danfojs icon indicating copy to clipboard operation
danfojs copied to clipboard

DataFrame.addColumn used to update an existing column results in no longer being able to access the column

Open nholmes3 opened this issue 3 years ago • 0 comments

Describe the bug When you use the addColumn function to update an existing column with a Series, the resulting DataFrame is now buggy and you are no longer able to access that column with DataFrame.column

To Reproduce Steps to reproduce the behavior:

const df = new dfd.DataFrame([{'foo': 'bar'}]);
const updatedColumn = df.column('foo').apply(() => 'newValue', { inplace: false });
df.addColumn('foo', updatedColumn, {inplace: true});
const newColumn = df.column('foo');

results in the following trace:

trace: "Error: File format not supported!\n    at Series.NDframe (/project/node_modules/danfojs-node/dist/danfojs-base/core/generic.js:97:23)\n    at new Series (/project/node_modules/danfojs-node/dist/danfojs-base/core/series.js:134:28)\n    at DataFrame.$getColumnData (/project/node_modules/danfojs-node/dist/danfojs-base/core/frame.js:196:24)\n    at DataFrame.column (/project/node_modules/danfojs-node/dist/danfojs-base/core/frame.js:1939:21)\n

Expected behavior We should be able to access the column data after an update

Desktop (please complete the following information):

  • Runtime: node:16 docker image
  • Version: "danfojs-node": "1.1.1",

nholmes3 avatar Sep 16 '22 22:09 nholmes3