PERF: Faster SparseArray.getitem for boolean masks (#23122) by bdrum · Pull Request #44955 · pandas-dev/pandas (original) (raw)

Sure. Here it is:

FAILED pandas/tests/arithmetic/test_datetime64.py::TestDatetime64ArrayLikeComparisons::test_dt64arr_cmp_arraylike_invalid[numexpr-tzlocal()-Index-other3]

self = <pandas.tests.arithmetic.test_datetime64.TestDatetime64ArrayLikeComparisons object at 0x000001F5FE6B3790> other = array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=object) tz_naive_fixture = tzlocal() box_with_array = <class 'pandas.core.indexes.base.Index'>

@pytest.mark.parametrize(
    "other",
    [
        # GH#4968 invalid date/int comparisons
        list(range(10)),
        np.arange(10),
        np.arange(10).astype(np.float32),
        np.arange(10).astype(object),
        pd.timedelta_range("1ns", periods=10).array,
        np.array(pd.timedelta_range("1ns", periods=10)),
        list(pd.timedelta_range("1ns", periods=10)),
        pd.timedelta_range("1 Day", periods=10).astype(object),
        pd.period_range("1971-01-01", freq="D", periods=10).array,
        pd.period_range("1971-01-01", freq="D", periods=10).astype(object),
    ],
)
def test_dt64arr_cmp_arraylike_invalid(
    self, other, tz_naive_fixture, box_with_array
):
    tz = tz_naive_fixture

    dta = date_range("1970-01-01", freq="ns", periods=10, tz=tz)._data
    obj = tm.box_expected(dta, box_with_array)

> assert_invalid_comparison(obj, other, box_with_array)

pandas\tests\arithmetic\test_datetime64.py:122:


pandas\tests\arithmetic\common.py:111: in assert_invalid_comparison result = xbox2(left == right) pandas\core\ops\common.py:70: in new_method return method(self, other) pandas\core\arraylike.py:40: in eq return self._cmp_method(other, operator.eq) pandas\core\indexes\base.py:6591: in _cmp_method result = op(self._values, other) pandas\core\ops\common.py:70: in new_method return method(self, other) pandas\core\arraylike.py:40: in eq return self._cmp_method(other, operator.eq) pandas\core\arrays\datetimelike.py:1024: in _cmp_method op, np.asarray(self.astype(object)), other pandas\core\arrays\datetimes.py:666: in astype return dtl.DatetimeLikeArrayMixin.astype(self, dtype, copy) pandas\core\arrays\datetimelike.py:413: in astype converted = ints_to_pydatetime( pandas_libs\tslibs\vectorized.pyx:177: in pandas._libs.tslibs.vectorized.ints_to_pydatetime local_value = tz_convert_utc_to_tzlocal(value, tz) pandas_libs\tslibs\tzconversion.pyx:383: in pandas._libs.tslibs.tzconversion.tz_convert_utc_to_tzlocal return _tz_convert_tzlocal_utc(utc_val, tz, to_utc=False, fold=fold) pandas_libs\tslibs\tzconversion.pyx:594: in pandas._libs.tslibs.tzconversion._tz_convert_tzlocal_utc delta = _tzlocal_get_offset_components(val, tz, to_utc, fold) pandas_libs\tslibs\tzconversion.pyx:554: in pandas._libs.tslibs.tzconversion._tzlocal_get_offset_components dt = dt.astimezone(tz) ......\Anaconda3\envs\pandas-dev\lib\site-packages\dateutil\tz_common.py:144: in fromutc return f(self, dt) ......\Anaconda3\envs\pandas-dev\lib\site-packages\dateutil\tz_common.py:261: in fromutc _fold = self._fold_status(dt, dt_wall) ......\Anaconda3\envs\pandas-dev\lib\site-packages\dateutil\tz_common.py:196: in _fold_status if self.is_ambiguous(dt_wall): ......\Anaconda3\envs\pandas-dev\lib\site-packages\dateutil\tz\tz.py:254: in is_ambiguous naive_dst = self._naive_is_dst(dt)


self = tzlocal(), dt = datetime.datetime(1969, 12, 31, 21, 0, tzinfo=tzlocal())

def _naive_is_dst(self, dt):
    timestamp = _datetime_to_timestamp(dt)

> return time.localtime(timestamp + time.timezone).tm_isdst E OSError: [Errno 22] Invalid argument

......\Anaconda3\envs\pandas-dev\lib\site-packages\dateutil\tz\tz.py:260: OSError