REGR: copy()
within apply()
raises ValueError: cannot create a DatetimeTZBlock without a tz, as of 1.0.0
#31505
Labels
Regression
Functionality that used to work in a prior pandas version
Milestone
Code Sample, a copy-pastable example if possible
Minimal example:
Real-life usage:
Exception:
Problem description
Essentially, the problem arises when
.copy()
is called from with an.apply
call, on a row/column of a DataFrame which:object
Timestamp
objectsWhile this seems like a fairly artificial set of conditions, as the "real world example" above is intended to demonstrate, it can indeed occur "organically". Appending rows to an initially empty
DataFrame
results in the dtype defaulting toobject
for all columns, so if thefilters
passed tofilter_dataframe_by_dict
happen to only consist of timestamp-valued columns, the error conditions are met.Note that the error only seems to arise in
.apply
calls; making the same calls on the rows return usingiterrrows()
oriloc
works just fine.This problem only occurs as of the latest pandas 1.0.0 release.
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: