-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Closed
Copy link
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsNeeds InfoClarification about behavior needed to assess issueClarification about behavior needed to assess issue
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
change_date["latest_change_at"].fillna(np.datetime64('2001-01-01T00:00:00'), inplace=True)
AssertionError: Did not expect new dtype datetime64[ns] to equal self.dtype datetime64[ns]. Please report a bug at https://github.com/pandas-dev/pandas/issues.
Issue Description
Original code was:
change_date["latest_change_at"].fillna("2001-01-01T00:00:00Z", inplace=True)
This is my error:
Value '2001-01-01T00:00:00Z' has dtype incompatible with datetime64[ns], please explicitly cast to a compatible dtype first.
So I tried to change the values for the fillna to datetime64[ns] by running this:
change_date["latest_change_at"].fillna(np.datetime64('2001-01-01T00:00:00'), inplace=True)
Expected Behavior
This should cast.
Installed Versions
Pandas 2.1.4
Metadata
Metadata
Assignees
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsNeeds InfoClarification about behavior needed to assess issueClarification about behavior needed to assess issue