Skip to content
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.

[BUG] DataFrame is not a constructor #134

Open
irohitb opened this issue Aug 17, 2022 · 3 comments
Open

[BUG] DataFrame is not a constructor #134

irohitb opened this issue Aug 17, 2022 · 3 comments
Labels

Comments

@irohitb
Copy link

irohitb commented Aug 17, 2022

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

@irohitb irohitb added the bug label Aug 17, 2022
@Gmousse
Copy link
Owner

Gmousse commented Sep 2, 2022

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"]);

@irohitb
Copy link
Author

irohitb commented Sep 2, 2022

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

@DanKaplanSES
Copy link

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants