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

Deprecated toJSON, toCSV, and toExcel methods in frame and series #440

Merged
merged 1 commit into from
Apr 4, 2022

Conversation

risenW
Copy link
Member

@risenW risenW commented Apr 4, 2022

Closes #439

This PR deprecates toJSON, toCSV, and toExcel methods. That means we can no longer call them directly on DataFrames and Series, we instead favor using the functions directly. For example:

const dfd = require("danfojs")

let data = {
    Abs: [20.2, 30, 47.3],
    Count: [34, 4, 5],
    "country code": ["NG", "FR", "GH"],
};

let df = new dfd.DataFrame(data);

df.toCSV({ filePath: "testOut.csv"}); // 👎🏾   won't work anymore from v1.1.0

dfd.toCSV(df, { filePath: "testOut.csv"}); // 👍🏾  Prefered and will work

WHY DID WE DEPRECATE THESE METHODS?
The major reason for deprecating these methods In favor of the functional style is because it is easier and cleaner to separate browser implementation from Nodejs implementation. This ensures we don't do more weird bundling and support Webpack >5 out of the box without extensive configuration.

@risenW risenW merged commit 182bec1 into dev Apr 4, 2022
@risenW risenW deleted the ref/io-output branch April 4, 2022 10:07
@idhamari
Copy link

In my case, nothing is saved and no error message. Any thought? I am using windows and CDN link for the library

@risenW
Copy link
Member Author

risenW commented Jul 15, 2022

In my case, nothing is saved and no error message. Any thought? I am using windows and CDN link for the library

Seen this: https://danfo.jsdata.org/api-reference/input-output/danfo.to_csv#convert-dataframe-to-csv-string-and-download-file-in-client-side-lib

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

Successfully merging this pull request may close these issues.

sample.toJSON() broke in 1.0.5
2 participants