Skip to content

Bug: AttributeError with get_values() in read_csv_dataset Function  #8

@rabiyasalehjee

Description

@rabiyasalehjee

Issue: AttributeError with get_values() in read_csv_dataset Function

Description
I encountered an AttributeError while running the read_csv_dataset function in input_output.py. The error specifically pointed to the use of get_values() with a pandas Index object:

AttributeError: 'Index' object has no attribute 'get_values'

Environment

  • Python version: 3.8.0
  • Pandas version: 0.25.3

Cause
The get_values() method was removed from pandas, starting with later versions. Since I am using an older version of pandas (0.25.3), the code ran into compatibility issues.

Solution
I resolved the issue by modifying the following lines in input_output.py:

# Old code
return [dataset_dataframe.columns.get_values().tolist()] + dataset_dataframe.get_values().tolist(), dataset_dataframe_version

# Updated code
return [dataset_dataframe.columns.to_list()] + dataset_dataframe.to_numpy().tolist(), dataset_dataframe_version

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions