Skip to content

BUG: Transpose changes dtype from object to timedelta/datetime #51546

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

Closed
3 tasks done
phofl opened this issue Feb 22, 2023 · 1 comment · Fixed by #51565
Closed
3 tasks done

BUG: Transpose changes dtype from object to timedelta/datetime #51546

phofl opened this issue Feb 22, 2023 · 1 comment · Fixed by #51565
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions

Comments

@phofl
Copy link
Member

phofl commented Feb 22, 2023

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

df = DataFrame({"a": [pd.Timedelta("1 days"), pd.NaT, pd.Timedelta("2 days")]}, dtype=object)
df.T.dtypes


0    timedelta64[ns]
1     datetime64[ns]
2    timedelta64[ns]
dtype: object

Issue Description

I'd expected this to return object, but this was changed in #26285

Expected Behavior

The whatsnew looks like the fix was tailored to avoid raising an error, any other motivations?

Installed Versions

Replace this line with the output of pd.show_versions()

@phofl phofl added Bug Needs Triage Issue that has not been reviewed by a pandas team member Dtype Conversions Unexpected or buggy dtype conversions labels Feb 22, 2023
@jbrockmendel
Copy link
Member

I'd expect object too

@lithomas1 lithomas1 removed the Needs Triage Issue that has not been reviewed by a pandas team member label Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants