-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: pd.Series in pandas>=3 does not preserve object dtype metadata #10564
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
base: main
Are you sure you want to change the base?
Conversation
…ta [test-upstream]
This seems like an upstream bug. Can you open an issue there please? |
Done! |
…o ig/fix_string_dtype
… ig/fix_series_cast
Co-authored-by: Deepak Cherian <[email protected]>
…o ig/fix_string_dtype
Co-authored-by: Deepak Cherian <[email protected]>
for more information, see https://pre-commit.ci
@@ -216,7 +217,16 @@ def _possibly_convert_objects(values): | |||
* pd.Timedelta | |||
""" | |||
as_series = pd.Series(values.ravel(), copy=False) | |||
# For why we need this behavior: https://github.com/pandas-dev/pandas/issues/61938 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add a little more please "pandas will convert to str if possible; preserve object dtype metadata in all other cases"
we should update the docstring to say strings too.
result = np.asarray(as_series).reshape(values.shape) | ||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this after the writable
bit below instead?
Only opening this here ATM to see that CI runs through. The diff is otherwise as advertised in #10559 (comment)
whats-new.rst
api.rst