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
The dense version goes through DatetimeArray.astype, for which .astype to int64 is basically a view (xref #45034). The Sparse version goes through astype_nansafe which specifically checks for NaTs when going from dt64->int64. I expected this to match the non-sparse behavior.
When converting to Sparse[int64], we only call astype_nansafe on the non-NaT elements so it doesn't raise, but when converting the fill_value from NaT it somehow gets 0, whereas I expected that to raise.
Side-notes: ser.astype(pd.SparseDtype(ser.dtype)) raises, as does dense.astype("Sparse[int64]")
The text was updated successfully, but these errors were encountered:
The dense version goes through
DatetimeArray.astype
, for which .astype to int64 is basically a view (xref #45034). The Sparse version goes throughastype_nansafe
which specifically checks for NaTs when going from dt64->int64. I expected this to match the non-sparse behavior.When converting to
Sparse[int64]
, we only call astype_nansafe on the non-NaT elements so it doesn't raise, but when converting the fill_value from NaT it somehow gets 0, whereas I expected that to raise.Side-notes:
ser.astype(pd.SparseDtype(ser.dtype))
raises, as doesdense.astype("Sparse[int64]")
The text was updated successfully, but these errors were encountered: