danfojs icon indicating copy to clipboard operation
danfojs copied to clipboard

Browser excel output docs don't match types

Open matt-erhart opened this issue 3 years ago • 0 comments

https://github.com/javascriptdata/danfojs/blob/a8d14d45bca2a50836a6e2d6ec1a77582c42993a/src/danfojs-base/shared/types.ts#L409

https://danfo.jsdata.org/api-reference/dataframe/dataframe.to_excel#convert-dataframe-to-excel-and-download-the-file-in-a-browser

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

let df = new dfd.DataFrame(data);

df.toExcel({ fileName: "testOut.xlsx", download: true }); //deprecated, docs have download, but types appear not to
dfd.toExcel(df, { fileName: "testOut.xlsx", download: true}); //current, docs have download, but types appear not to

When I try to run it with download: true, I get the following error: Uncaught Error: Module "fs" has been externalized for browser compatibility. Cannot access "fs.writeFileSync" in client code. but I'm not sure if that's a danfo issue or a vitejs issue at the moment. dfd.toCSV works as expected.

matt-erhart avatar Aug 31 '22 21:08 matt-erhart