Skip to content

CLN: move raising TypeError for interpolate with object dtype to Block #58083

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

Conversation

natmokval
Copy link
Contributor

xref #57820

moved raising TypeError for interpolate with object dtype from NDFrame to Block

if self.dtype == _dtype_obj:
# only deal with floats
# bc we already checked that can_hold_na, we don't have int dtype here
# test_interp_basic checks that we make a copy here
return [self.copy(deep=False)]
raise TypeError(
f"{type(self).__name__} cannot interpolate with object dtype."
Copy link
Member

Choose a reason for hiding this comment

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

we dont need to have Block in the exception message. the comments in the line above can be removed. can you add "# GH#53631"

Copy link
Member

Choose a reason for hiding this comment

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

can do something like name = {1: "Series", 2: "DataFrame"}[self.ndim] to keep the exception message unchanged

Copy link
Contributor Author

@natmokval natmokval Mar 31, 2024

Choose a reason for hiding this comment

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

thank you, I made these changes, ci - green.

@natmokval natmokval marked this pull request as ready for review March 31, 2024 18:51
@natmokval natmokval added Clean Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate labels Mar 31, 2024
Copy link
Member

@jbrockmendel jbrockmendel left a comment

Choose a reason for hiding this comment

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

LGTM

@jbrockmendel jbrockmendel merged commit 33af3b8 into pandas-dev:main Apr 1, 2024
@jbrockmendel
Copy link
Member

thanks @natmokval

pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
…Block (pandas-dev#58083)

* move raising for interpolate with object dtype from NDFrame to Block

* correct msg in test_interpolate_cannot_with_object_dtype

* correct the exception message and the comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants