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
In some rare cases, I may have a datetime column that is represented as a float or integer dtype. When this happens, I will always have a datetime_format string that specifies how to read this.
Example:
A column of all nan values
A column with format '%Y%m%d' such as [20120212, 20100321, 20091102, ...]
If this happens, then the output dtype (on the reverse_transform) is not the same dtype as the input.
Proposed Fix
On the fit:
Store the original _dtype of the input column
On the transform:
Convert it to a string (astype("string") to make sure the NaNs are properly converted)
Parse to pd.datetime to using the provided datetime_format
Convert from pd.datetime -> unix timestamp
On the reverse_transform:
Convert from unix timestamp -> pd.datetime
Convert it to a string (using datetime_format)
Convert back to the original _dtype
The text was updated successfully, but these errors were encountered:
Environment Details
Error Description
In some rare cases, I may have a datetime column that is represented as a float or integer dtype. When this happens, I will always have a datetime_format string that specifies how to read this.
Example:
'%Y%m%d'
such as[20120212, 20100321, 20091102, ...]
If this happens, then the output dtype (on the
reverse_transform
) is not the same dtype as the input.Proposed Fix
On the fit:
_dtype
of the input columnOn the transform:
astype("string")
to make sure the NaNs are properly converted)pd.datetime
to using the provideddatetime_format
pd.datetime
-> unix timestampOn the reverse_transform:
pd.datetime
datetime_format
)_dtype
The text was updated successfully, but these errors were encountered: