Skip to content

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

Description

@nholmes3

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",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions