Skip to content

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

Description

@idobarlev2

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions