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

API: replace casting dtype instead of converting NA value when replacing missing value with another missing value #49421

Open
phofl opened this issue Oct 31, 2022 · 0 comments
Labels
API - Consistency Internal Consistency of API/Behavior Dtype Conversions Unexpected or buggy dtype conversions replace replace method

Comments

@phofl
Copy link
Member

phofl commented Oct 31, 2022

See discussion in #48234

when doing

pd.Series([1.0, np.nan]).replace(np.nan, value=None)

this casts to object, which is inconsistent with what other methods do.

The non special logic would look like:

def replace(self, old, new):
    if is_valid_na_for_dtype(new, self.dtype):
        new = self. _standardize_fill_value(new)

cc @jbrockmendel @mroeschke

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Dtype Conversions Unexpected or buggy dtype conversions replace replace method
Projects
None yet
Development

No branches or pull requests

1 participant