-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
[bug] don't remove timezone-awareness when using the method from Dat… #30277
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] don't remove timezone-awareness when using the method from Dat… #30277
Conversation
7c4e047
to
6357d84
Compare
05352dc
to
7ccc897
Compare
6e99e17
to
f59cf29
Compare
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.
append is overly complicated and duplicating many parts of concat.
I think you might be able to remove almost all of 6751-6771, e.g. once its a Series . All of the column stuff is not necessary (I could be wrong but give this a try)
IOW this does the right thing
In [17]: df = pd.DataFrame({'A': pd.date_range('20130101', periods=3, tz='UTC'), 'B': range(3)})
In [18]: pd.concat([df, df.iloc[0].to_frame().T.infer_objects()]).dtypes
Out[18]:
A datetime64[ns, UTC]
B int64
dtype: object
3b5cab7
to
22d3dc9
Compare
@jreback Tried this, but it seems it's necessary for |
@MarcoGorelli this change solved the original issue. Maybe give this a shot:
|
c36b337
to
383694c
Compare
@mroeschke I would still need to reshape though, wouldn't I? Else I don't see how
would pass. But if I do reshape, then
And I can't just pass the |
383694c
to
f87f987
Compare
Extension arrays (DatetimeArray) are still essentially 1D only right now, so reshaping is not possible. As you can see in the |
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.
small changes. I would also like to test this with categorical, nullable integer and other extension types (likely this fixes).
so if you can file an issue for this (and followup PR would be great).
can also do here if you'd like alternately
d61979d
to
e5a08c7
Compare
@mroeschke Thanks for your explanation. What would you like me to do then, use |
@jreback thanks for your review, I've made those changes. I've opened up another issue for the other dtypes, will work on that next week if no one else has taken it up by then |
thanks! |
…aFrame
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff