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
where all dates or hours are strings. When doing a groupby on the date and then accessing the value in column time where value is maximal, the hour string is converted to a datetime:
In [21]: df.groupby('date').apply(lambda x: x['time'][x['value'].idxmax()])
Out[21]:
date
2011.05.16 2013-12-29 00:00:00
2011.05.17 2013-12-29 02:00:00
2011.05.18 2013-12-29 02:00:00
dtype: datetime64[ns]
while in 0.12 this remains a string:
In [63]: df.groupby('date').apply(lambda x: x['time'][x['value'].idxmax()])
Out[63]:
date
2011.05.16 00:00
2011.05.17 02:00
2011.05.18 02:00
dtype: object
I think in this case this conversion can be highly inappropriate (and you have a chance that just because a string is looking like a date/time component it is converted, while this will not always be your intention).
The text was updated successfully, but these errors were encountered:
(Encountered with same SO question as #5786 and #5788. With following dataframe:
where all dates or hours are strings. When doing a groupby on the date and then accessing the value in column
time
wherevalue
is maximal, the hour string is converted to a datetime:while in 0.12 this remains a string:
I think in this case this conversion can be highly inappropriate (and you have a chance that just because a string is looking like a date/time component it is converted, while this will not always be your intention).
The text was updated successfully, but these errors were encountered: