BUG: read-only values in cython funcs by jbrockmendel · Pull Request #37613 · pandas-dev/pandas (original) (raw)
@jbrockmendel I'm struggling with this. (working on 1.1x so maybe differences with master)
can you justify this change other than tests were failing.
somethings changed in the internals dispatch where other in the _addsub_object_array call is now a scalar (in a 2d array with shape 1,1) for the failing test_td64arr_add_sub_object_array
test instead of a 2d array on 1.1.x
so not raising a performance warning makes sense if other is now a 'scalar'
(also the repr fails for a 2d timedelta array)
on 1.1.x
(Pdb) other
array([[Timedelta('1 days 00:00:00')],
[<2 * Days>]], dtype=object)
(Pdb) a
Traceback (most recent call last):
...
ValueError: Value must be Timedelta, string, integer, float, timedelta or convertible, not TimedeltaArray
(Pdb) self._data
array([[ 86400000000000],
[172800000000000]], dtype='timedelta64[ns]')
(Pdb)
with the patch applied ( #37633)
c:\users\simon\pandas\pandas\core\arrays\datetimelike.py(1337)_addsub_object_array()
-> assert op in [operator.add, operator.sub]
(Pdb) other
array([[<2 * Days>]], dtype=object)
(Pdb) self._data
array([[172800000000000]], dtype='timedelta64[ns]')
(Pdb)