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
This issue was identified as a result of a reported bug (#12821 ) where datetime64[ns] columns are returned as float64 following agg() function where all dates in a group are NaT. Converting columns back to datetime64[ns] format is necessary. However, identifying valid numeric values as errors when errors='coerce' and returning NaT values results in unnecessary data-loss.
Expected Output
date group
0 2015-06-19 05:33:20 a
1 2015-05-27 22:33:20 b
The text was updated successfully, but these errors were encountered:
lvphj
changed the title
Converting integer values to datetime results in NaT if errors='coerce'
Converting float64 values to datetime64[ns] format using pd.to_datetime results in NaT if errors='coerce'
May 15, 2016
yeah I had previously removed the path for unit processing from array_to_datetime as was subsumed by array_with_unit_to_datetime. But I also removed the default unit to None from ns (IOW it would only trigger if passed). So this was an oversite.
Code Sample, a copy-pastable example if possible
A Pandas dataframe contains a date variable that is formatted as float64 as follows:
Which appears as:
The date variables can be formatted to datetime64[ns] as follows:
Which works as expected:
However, if errors='coerce' is included in the do_datetime() function, the dates are returned as NaT.
Which produces the following:
This issue was identified as a result of a reported bug (#12821 ) where datetime64[ns] columns are returned as float64 following agg() function where all dates in a group are NaT. Converting columns back to datetime64[ns] format is necessary. However, identifying valid numeric values as errors when errors='coerce' and returning NaT values results in unnecessary data-loss.
Expected Output
output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: