You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a quick peek. Inside _NDFrameIndexer._setitem_with_indexer(), this line here: self.obj._data = self.obj.reindex_axis(labels, i)._data is where the labels go from good to bad. The first reference to labels inside NDFrame.reindex_axis(...) is erroneous...
This code might help somebody more senior than I:
from pandas import DataFrame
from numpy import datetime64 as d64
from datetime import datetime as dt
df = DataFrame()
df.loc[d64(dt(2015,1,1,1,1,1)),'C1'] = 'GOOD'
df.loc[d64(dt(2015,1,1,1,1,1)),'C1'] = 'BAD'
df.loc[d64(dt(2015,1,1,1,1,2)),'C1'] = 'sec'
df.loc[d64(dt(2015,1,1,1,2,1)),'C1'] = 'min'
df.loc[d64(dt(2015,1,1,2,1,1)),'C1'] = 'hr'
df.loc[d64(dt(2015,1,2,1,1,1)),'C1'] = 'day'
df.loc[d64(dt(2015,2,1,1,1,1)),'C1'] = 'mth'
>>> df
C1
2015-01-01 01:01:01 BAD
1970-01-17 10:27:54.062000 sec
1970-01-17 10:27:54.121000 min
1970-01-17 10:27:57.661000 hr
1970-01-17 10:29:20.461000 day
1970-01-17 11:12:32.461000 mth
Notice the date component dropped, And the month/day/hour/minute/second specified is incrementing hour/minute/... respectively. Also notice that "GOOD" is over-written, by "BAD".
This is in Pandas
0.15.2
(but I also tried it on '0.15.2-148-g484f668'):This is the output:
It seems the the first usage of
loc
correctly works around limitations ofdatetime64
but I cannot explain the second one.The text was updated successfully, but these errors were encountered: