Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataFrame type incompatible between return type of readCSV and node exported DataFrame #567

Open
kitfit-dave opened this issue Apr 14, 2023 · 0 comments

Comments

@kitfit-dave
Copy link

The exact type of the DataFrame returned by readCSV (and probably any other base function that returns a base DataFrame) is not compatible with the one exported by the main node package. Code like this, which is what I think should work, does not work:

import { DataFrame, readCSV } from 'danfojs-node'

const textDataFrame: DataFrame = await readCSV('./test.csv')

Error is:

Type 'import("[...]/node_modules/danfojs-node/dist/danfojs-base/core/frame").default' is not assignable to type 'import("[...]/node_modules/danfojs-node/dist/danfojs-node/src/core/frame").default'.
  The types returned by 'toCSV(...)' are incompatible between these types.
    Type 'string | void' is not assignable to type 'string'.
      Type 'void' is not assignable to type 'string'.ts(2322)

The base NDFrame toCSV and toJSON implementations are just missing the function overload it seems. Maybe #440 changed that in one place but not the other?

It seems like just adding the overloads fixes this issue: #566

--
note, to get around the type problem for now without merging #566 one can:

const textDataFrame: DataFrame = await readCSV('./test.csv') as DataFrame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant