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

ENH - Improved error message for interpolating IntegerArrays (#41565) #42503

Conversation

AartGoossens
Copy link

This PR improves the error message when trying to interpolate dtype integer with method="linear", as discussed in #41565.

Copy link
Member

@mzeitlin11 mzeitlin11 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 @AartGoossens, sorry for the late review!

Is there a MaskedArray specific place we hit before ending up here? I think it would be better if we could catch it in a place where we know we have a MaskedArray (then we can compare the given methods to currently supported ones for masked data and just say that that interpolation method has not been implemented yet).

raise ValueError(
f"Invalid fill method. Expecting {expecting}. Got {method}."
" Are you trying to interpolate an integer column?"
)
Copy link
Member

Choose a reason for hiding this comment

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

This error seems like something which might occur more commonly in non-masked cases (from something like a typo) - maybe this is too specific (there are also other nullable types like Float which could end up here)

@mzeitlin11 mzeitlin11 added Error Reporting Incorrect or improved errors from pandas Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate NA - MaskedArrays Related to pd.NA and nullable extension arrays labels Jul 31, 2021
@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Aug 31, 2021
@mzeitlin11
Copy link
Member

Thanks for the pr, going to close for now as stale, but please ping to reopen if you'd like to continue working on it!

@mzeitlin11 mzeitlin11 closed this Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate NA - MaskedArrays Related to pd.NA and nullable extension arrays Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Better error message when interpolating dtype integer with method="linear"
2 participants