dataframe-js icon indicating copy to clipboard operation
dataframe-js copied to clipboard

[BUG] DataFrame is not a constructor

Open irbhatia opened this issue 3 years ago • 3 comments

Bug.

I am doing this

`import DataFrame from 'dataframe-js'`

 const df = new DataFrame({c1: 1, c2: 6, c3: 9, c4: 10, c5: 12}, ['c1', 'c2', 'c3', 'c4', 'c5', 'c6'])

but this keeps throwing error that DataFrame is not a constructor

irbhatia avatar Aug 17 '22 13:08 irbhatia

Hi, Indeed, the default export seems not working well.

It seems working when not importing the default.

Workaround in esm:

import { DataFrame } from "dataframe-js";

const df = new DataFrame([[1, 2, 3]], ["a", "b", "c"]);

or in cjs:

const DataFrame = require("dataframe-js").default;

const df = new DataFrame([[1, 2, 3]], ["a", "b", "c"]);

Gmousse avatar Sep 02 '22 15:09 Gmousse

@Gmousse Thanks, I was able to make it work using the workaround.

irbhatia avatar Sep 02 '22 15:09 irbhatia

@Gmousse I came here to report a similar issue, but I was going to suggest updating the documentation, as this took me 20+ minutes to troubleshoot.

Alternatively/even better, you could fix the default export to work the way the documentation says it will. I don't have the time at the moment to research how to do that, but it might be a breaking change for others that already use the library. I'm not sure if that's an option.

DanKaplanSES avatar Feb 06 '23 20:02 DanKaplanSES