danfojs icon indicating copy to clipboard operation
danfojs copied to clipboard

Error: rows parameter must be an Array - when using query function

Open george-assan opened this issue 2 years ago • 2 comments

Have attempted to us the query function on a dataframe i crated from Excel file with no success. Keep getting the same error. Finally tried the simple approach of creating a dataframe but got the same error.

tried with this code:

const dfd = require("danfojs-node");

// Sample data let data = { "Name": ["Alice", "Bob", "Charlie", "Alice", "Eve", "Frank"], "Age": [25, 30, 35, 29, 40, 45], "Occupation": ["Engineer", "Doctor", "Teacher", "Engineer", "Lawyer", "Artist"] };

// Create DataFrame let df = new dfd.DataFrame(data);

// Display the original DataFrame console.log("Original DataFrame:"); df.print();

// Query rows where 'Name' is 'Alice' let filteredDf = df.query({ "column": "Name", "is": "==", "to": "Alice" });

// Display the filtered DataFrame console.log("\nRows where Name is 'Alice':"); filteredDf.print();

I am expecting it to produce a dataframe with rows with name = "Alice"

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: mac
  • Node.js v18.16.0
  • Danfo.js Version 1.1.2

george-assan avatar Aug 31 '23 19:08 george-assan

I am experiencing the same issue. Has any progress been made here?

jacobnorris0703 avatar Nov 16 '23 15:11 jacobnorris0703

Facing the same issue. Any progress ?

HassanAtWecrunch avatar Jun 05 '24 16:06 HassanAtWecrunch