-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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: extending object series on assignment with datetime coerces to int #18410
Comments
can you make a much simpler example |
I am facing a similar issue. If I stored a dataframe with date index into hdfs with table format, the index becomes integers.
While it does not happen with store into fixed format.
|
@omytea you are using a non-first-class type |
closing as not repro |
so small example, with 0.20.3:
and with master:
|
So there are two different things under the hood: 1. "Assigning with extending" an object series with a datetime / timestamp introduces an int:
The above happens both on master as in 0.20.3 (so didn't change), and looks like a bug to me. 2. When you have a series of int and assign a Timestamp / datetime into it, previously it changed to datetime64 dtype, now it changes to object dtype:
This change caused the 'bug' to surface. But this change was a good change, as we should not special case Series of length 1 (if you have a longer int series and assign a Timestamp into it, you end up with a mixed object dtype). |
@bear0330 you can easily fix your code by changing the |
Updated top post and title to only deal with issue 1. from #18410 (comment) |
Closing in favor of #13910, but will reference examples from this issues. |
"Assigning with extending" an object series with a datetime / timestamp introduces an int:
original report:
Code Sample, a copy-pastable example if possible
Problem description
Under 0.21 (0.20.3, 0.19 ...etc) I got expected result when I call
But After upgrade to 0.21, I got
datetime object assigned to index becomes int type.
ind[i] = t
Expected Output
Output of
pd.show_versions()
0.21
The text was updated successfully, but these errors were encountered: