danfojs icon indicating copy to clipboard operation
danfojs copied to clipboard

Issue with Retrieving Columns Named with Colon ':' in Single Selection Using danfojs-node

Open idobarlev2 opened this issue 1 year ago • 0 comments

Describe the bug In danfojs-node, when attempting to retrieve data from a DataFrame based on a single column name that contains a colon (':'), the operation fails with a ColumnIndexError. However, retrieving multiple columns where each includes a colon in their names does not produce this error.

To Reproduce Steps to reproduce the behavior:

Import DataFrame from danfojs-node. Create a DataFrame and attempt to access a single column with a colon in its name using the .loc() method. Observe the ColumnIndexError.

Expected behavior The .loc() method should consistently handle column names with colons, whether accessing a single column or multiple columns.

Code Snippets Here is the code snippet that produces the error:

import { DataFrame } from "danfojs-node";
// Assuming myDF is already defined and contains the necessary columns
let myDF: DataFrame;
myDF.loc({ columns: ['my : column'] })  // This triggers an error

Error message received:

ColumnIndexError: Invalid row split parameter. If using a row split string, it must be of the form; rows: ["start:end"]

However, the following code works without any issues:

import { DataFrame } from "danfojs-node";
// Assuming myDF is already defined and contains the necessary columns
let myDF: DataFrame;
myDF.loc({ columns: ['my : column', 'my : other : column'] })  // This works fine

Environment: danfojs-node version: ^1.1.2 Node.js version: v18.13.0

Additional context The error suggests there may be an issue with how the .loc() method parses the column names when there is only a single column with special characters like a colon.

idobarlev2 avatar Apr 17 '24 14:04 idobarlev2