You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [1]: importpandasaspdIn [2]: arr=pd.date_range('2017', periods=4, tz='US/Eastern')
In [3]: s=pd.Series(arr, index=[(0, 1), (0, 2), (0, 3), (0, 4)])
In [4]: s[(0, 1)] =float('NaN')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
~/sandbox/pandas-ip/pandas/pandas/core/series.py in setitem(key, value)
871try:
--> 872 self._set_with_engine(key, value)
873return
~/sandbox/pandas-ip/pandas/pandas/core/series.py in _set_with_engine(self, key, value)
930try:
--> 931 self.index._engine.set_value(values, key, value)
932returnTypeError: Argument 'arr' has incorrect type (expected numpy.ndarray, got DatetimeIndex)
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-4-0a0fdcf8dcd6> in <module>()
----> 1 s[(0, 1)] = float('NaN')
~/sandbox/pandas-ip/pandas/pandas/core/series.py in __setitem__(self, key, value)
922# do the setitem923 cacher_needs_updating =self._check_is_chained_assignment_possible()
--> 924 setitem(key, value)
925if cacher_needs_updating:
926self._maybe_update_cacher()
~/sandbox/pandas-ip/pandas/pandas/core/series.py in setitem(key, value)
904if (isinstance(key, tuple) and905notisinstance(self.index, MultiIndex)):
--> 906 raise ValueError("Can only tuple-index with a MultiIndex")
907908# python 3 type errors should be raisedValueError: Can only tuple-index with a MultiIndex
A bit of an edge case
xref #19907 (comment)
The text was updated successfully, but these errors were encountered: