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

BUG: DataFrame(dt64data, dtype=td64) corner cases #38792

Merged
merged 7 commits into from
Dec 31, 2020

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

pandas/core/internals/construction.py Outdated Show resolved Hide resolved
result = df.to_records()
result["index"].dtype == "M8[ns]"

result = df.to_records(index=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

can you assert the expected (or something about it)

Copy link
Member Author

Choose a reason for hiding this comment

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

this is just moving the existing test to the correct location. i can revert the move as out of scope

Copy link
Contributor

Choose a reason for hiding this comment

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

its fine to move, but if you can an expected value would be good

Copy link
Member Author

Choose a reason for hiding this comment

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

reverted this move

@jreback
Copy link
Contributor

jreback commented Dec 30, 2020

what is the user facing change?

@jreback jreback added Bug Dtype Conversions Unexpected or buggy dtype conversions Datetime Datetime data dtype labels Dec 30, 2020
@jbrockmendel
Copy link
Member Author

what is the user facing change?

dt = np.datetime64(4, "ns")
dtype = np.dtype("m8[ns]")

pd.DataFrame({"A": [dt, dt]}, dtype=dtype)  # <-- fails to raise on master (though it doesn't cast to td64, so maybe OK?)
from datetime import datetime

scalar = datetime(9999, 1, 1)
pd.DataFrame(scalar, index=[0], columns=[0])  # <-- raises OutOfBoundsDatetime on master

@jreback
Copy link
Contributor

jreback commented Dec 31, 2020

kk change looks good, i think need a whatsnew note though as this is now working

@jreback jreback added this to the 1.3 milestone Dec 31, 2020
@jbrockmendel
Copy link
Member Author

whatsnew added + green

@jreback jreback merged commit 48edcad into pandas-dev:master Dec 31, 2020
@jbrockmendel jbrockmendel deleted the bug-construction branch January 1, 2021 02:04
luckyvs1 pushed a commit to luckyvs1/pandas that referenced this pull request Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants