Result of DataFrameGroupBy.apply(lambda x: pd.Series(...)) can have values incorrectly cast from object (string) to pd.Timestamp for a DataFrame with at least one datetime64[ns] dtype column #9505
Labels
Bug
Dtype Conversions
Unexpected or buggy dtype conversions
Duplicate Report
Duplicate issue or pull request
Milestone
See repro below:
It looks like this is happening because pd.Timestamp('TH') is valid and results in no exceptions. If you replace the string 'TH' with something else then the resulting column's dtype is object, as expected. The order of columns in the above example does not matter.
For comparison, this case works as expected:
output of show_versions() below (using Miniconda):
The text was updated successfully, but these errors were encountered: