Skip to content

Short term pandas 2.0 support: avoid pandas==2.0 installation. #159

Closed

Description

@sandervh14

Task Title

Task: Short term pandas 2.0 support: avoid pandas==2.0 installation.

Task Description

On installing a fresh conda environment for a cobra experiment just now, I got this error during pandas preprocessing:

File ~/.conda/envs/cobra/lib/python3.9/site-packages/cobra/preprocessing/kbins_discretizer.py:330, in KBinsDiscretizer._transform_column(self, data, column_name, bins)
    324 data.loc[:, column_name_bin] = (data[column_name_bin]
    325                                 .cat.rename_categories(bin_labels))
    327 if data[column_name_bin].isnull().sum() > 0:
    328 
    329     # Add an additional bin for missing values
--> 330     data[column_name_bin].cat.add_categories(["Missing"], inplace=True)
    332     # Replace NULL with "Missing"
    333     # Otherwise these will be ignored in groupby
    334     data[column_name_bin].fillna("Missing", inplace=True)

(...)

TypeError: add_categories() got an unexpected keyword argument 'inplace'

Pandas 2.0 removed inplace arguments: https://pandas.pydata.org/docs/dev/whatsnew/v2.0.0.html

Add in the requirements.txt and readme.md a <=2.0.0 clarification for short term support, to avoid many cobra users struggling.

Activity

  1. sandervh14 commented on Apr 5, 2023

    @sandervh14
    ContributorAuthor

    This issue is for short term support. We can integrate pandas 2.0 on a longer term on issue #160.

  2. added this to the 2023-03 milestone on Apr 5, 2023
  3. ZlaTanskY commented on Apr 5, 2023

    @ZlaTanskY
    Contributor

    If this also inflicts cobra users who install by using pip install pythonpredictions-cobra, then the pandas version should be limited in setup.py as well. requirements.txt and conda_env.yml will only be used by cobra developers

  4. modified the milestones: 2023-03, on Apr 7, 2023
  5. linked a pull request that will close this issueShort term pandas 2.0 support #164on Apr 7, 2023
  6. self-assigned this
    on Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions