Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REGR: DataFrame.shift(axis=1) raises TypeError when columns is CategoricalIndex #38434

Closed
topper-123 opened this issue Dec 12, 2020 · 1 comment · Fixed by #38504
Closed

REGR: DataFrame.shift(axis=1) raises TypeError when columns is CategoricalIndex #38434

topper-123 opened this issue Dec 12, 2020 · 1 comment · Fixed by #38504
Labels
Bug Categorical Categorical Data Type Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@topper-123
Copy link
Contributor

A regression since 1.1:

>>> ci = pd.CategoricalIndex(["a", "b"])
>>> df = pd.DataFrame([[1, 2], [3, 4]], index=ci, columns=ci)
>>> df.shift(axis=0)  # ok
     a    b
a  NaN  NaN
b  1.0  2.0
>>> df.shift(axis=1)  # not ok, worked in v1.1
TypeError: 'fill_value=0' is not present in this Categorical's categories
@topper-123 topper-123 added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 12, 2020
@topper-123 topper-123 changed the title REGR: DataFrame.shift(Axis=1) when columns are CategoricalIndex REGR: DataFrame.shift(axis=1) raises TypeError when columns is CategoricalIndex Dec 12, 2020
simonjayhawkins added a commit to simonjayhawkins/pandas that referenced this issue Dec 13, 2020
@simonjayhawkins simonjayhawkins added Regression Functionality that used to work in a prior pandas version Categorical Categorical Data Type and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 13, 2020
@simonjayhawkins simonjayhawkins added this to the Contributions Welcome milestone Dec 13, 2020
@simonjayhawkins
Copy link
Member

A regression since 1.1:

first bad commit: [44ce988] BUG: df.diff axis=1 mixed dtypes (#36710) cc @jbrockmendel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Categorical Categorical Data Type Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants