Skip to content

Conversation

thaiv28
Copy link

@thaiv28 thaiv28 commented Sep 11, 2025

Added a test to TestFillNA to check that call fillna with a Series of dtype Categorical does not throw an error.

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

)

filler = Series(Categorical([10.0, 20.0, 30.0]))
df.fillna({"ints": filler}, inplace=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you avoid mutating here; when debugging, it can be helpful to have both before and after the operation accessible.

Suggested change
df.fillna({"ints": filler}, inplace=True)
result = df.fillna({"ints": filler})

tm.assert_frame_equal(df.fillna(value=NaT), df)

def test_fillna_with_categorical_series(self):
df = DataFrame(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a reference to the issue as a comment on the first line.

# https://github.com/pandas-dev/pandas/issues/56329

@rhshadrach rhshadrach added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Needs Tests Unit test(s) needed to prevent regressions Categorical Categorical Data Type labels Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Categorical Categorical Data Type Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Needs Tests Unit test(s) needed to prevent regressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: AssertionError: Did not expect new dtype float64 to equal self.dtype float64. Please report a bug

2 participants