javascriptdata / danfojs

Danfo.js is an open source, JavaScript library providing high performance, intuitive, and easy to use data structures for manipulating and processing structured data.
https://danfo.jsdata.org/
MIT License
4.79k stars 209 forks source link

error: File format not supported! while trying to reassign a column. #616

Open SalamanderXing opened 1 year ago

SalamanderXing commented 1 year ago

Describe the bug I'm trying to transform a column of a DataFrame:

import dfd from "danfojs-node";

const df = new dfd.DataFrame({
  a: [1, 2, 3],
  b: ["a", "b", "c"],
});

// ** METHOD 1 **
df["b"] = df["b"].map((value) => value.toUpperCase());

console.log(df["b"].values());
// error: File format not supported!

// ** METHOD 2 ** 
const transformed = df["b"].map((value) => value.toUpperCase());
df.addColumn(
  "b",
  transformed,
  { inplace: true },
);

console.log(df["b"].values());
// error: File format not supported!

Full error stack trace:

                throw new Error("File format not supported!");
                      ^

Error: File format not supported!
    at Series.NDframe (/home/bluesk/Documents/news_aggregator/news_
anfojs-base/core/generic.js:100:23)
    at new Series (/home/bluesk/Documents/news_aggregator/news_aggr
js-base/core/series.js:134:28)
    at DataFrame.$getColumnData (/home/bluesk/Documents/news_aggreg
ode/dist/danfojs-base/core/frame.js:196:24)
    at DataFrame.get (/home/bluesk/Documents/news_aggregator/news_a
nfojs-base/core/frame.js:147:37)
    at file:///home/bluesk/Documents/news_aggregator/news_aggregato
    at ModuleJob.run (node:internal/modules/esm/module_job:217:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:
    at async loadESM (node:internal/process/esm_loader:34:7)

To Reproduce Run the above code.

Expected behavior No error should be raised, I should be able to access the 'b' column and its values.

Desktop (please complete the following information):

vivere-dally commented 2 months ago

Up, facing the same issue