BUG: during interchanging from non-pandas tz-aware data by natmokval · Pull Request #54287 · pandas-dev/pandas (original) (raw)
I don't think this should be raising an error though
In
try:
data[null_pos] = None
except TypeError:
# TypeError happens if the `data` dtype appears to be non-nullable
# in numpy notation (bool, int, uint). If this happens,
# cast the `data` to nullable float dtype.
data = data.astype(float)
data[null_pos] = None
, could we add an extra except
, which catches SettingWithCopyError
, and in that case makes a copy of data
(data = data.copy()
) and then sets the nulls (data[null_pos] = None
)?