Closed
Description
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
import pandas as pd
print(pd.__version__)
dti = pd.date_range("1/1/2000", periods=3, tz="Europe/London")
a = pd.Series([dti[0], None, dti[2]])
b = pd.Series([None, dti[1], None])
a.update(b)
print(a)
Problem description
on master
1.1.0.dev0+1468.g3cebe3024
Traceback (most recent call last):
File "C:/Users/simon/test.py", line 10, in <module>
a.update(b)
File "c:\users\simon\pandas\pandas\core\series.py", line 2855, in update
self._mgr = self._mgr.putmask(mask=mask, new=other)
File "c:\users\simon\pandas\pandas\core\internals\managers.py", line 544, in putmask
return self.apply(
File "c:\users\simon\pandas\pandas\core\internals\managers.py", line 397, in apply
applied = getattr(b, f)(**kwargs)
File "c:\users\simon\pandas\pandas\core\internals\blocks.py", line 1604, in putmask
new_values[mask] = new
File "c:\users\simon\pandas\pandas\core\arrays\datetimelike.py", line 609, in __setitem__
self._data[key] = value
ValueError: NumPy boolean array indexing assignment cannot assign 3 input values to the 1 output values where the mask is true
regression in #27428
d717ad8 is the first bad commit
commit d717ad8
Author: jbrockmendel [email protected]
Date: Tue Jul 23 16:55:40 2019 -0700
CLN/REF: stop allowing iNaT in DatetimeBlock (#27428)
Expected Output
on 0.25.3
0.25.3
0 2000-01-01 00:00:00+00:00
1 2000-01-02 00:00:00+00:00
2 2000-01-03 00:00:00+00:00
dtype: datetime64[ns, Europe/London]
Output of pd.show_versions()
[paste the output of pd.show_versions()
here leaving a blank line after the details tag]