Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failing CI due to CFTimeIndex errors #5147

Closed
keewis opened this issue Apr 13, 2021 · 0 comments · Fixed by #5154
Closed

failing CI due to CFTimeIndex errors #5147

keewis opened this issue Apr 13, 2021 · 0 comments · Fixed by #5154

Comments

@keewis
Copy link
Collaborator

keewis commented Apr 13, 2021

the normal CI started to fail:

FAILED xarray/tests/test_cftimeindex.py::test_distant_cftime_datetime_sub_cftimeindex[365_day]
FAILED xarray/tests/test_cftimeindex.py::test_distant_cftime_datetime_sub_cftimeindex[360_day]
FAILED xarray/tests/test_cftimeindex.py::test_distant_cftime_datetime_sub_cftimeindex[julian]
FAILED xarray/tests/test_cftimeindex.py::test_distant_cftime_datetime_sub_cftimeindex[all_leap]
FAILED xarray/tests/test_cftimeindex.py::test_distant_cftime_datetime_sub_cftimeindex[366_day]
FAILED xarray/tests/test_cftimeindex.py::test_distant_cftime_datetime_sub_cftimeindex[gregorian]
FAILED xarray/tests/test_cftimeindex.py::test_distant_cftime_datetime_sub_cftimeindex[proleptic_gregorian]
traceback
[gw2] linux -- Python 3.9.2 /usr/share/miniconda/envs/xarray-tests/bin/python

>   ???
E   TypeError: Expected unicode, got datetime.timedelta

pandas/_libs/tslibs/timedeltas.pyx:264: TypeError

During handling of the above exception, another exception occurred:

calendar = 'proleptic_gregorian'

    @requires_cftime
    @pytest.mark.parametrize("calendar", _CFTIME_CALENDARS)
    def test_distant_cftime_datetime_sub_cftimeindex(calendar):
        a = xr.cftime_range("2000", periods=5, calendar=calendar)
        with pytest.raises(ValueError, match="difference exceeds"):
>           a.date_type(1, 1, 1) - a

/home/runner/work/xarray/xarray/xarray/tests/test_cftimeindex.py:833: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/coding/cftimeindex.py:581: in __rsub__
    return pd.TimedeltaIndex(other - np.array(self))
/usr/share/miniconda/envs/xarray-tests/lib/python3.9/site-packages/pandas/core/indexes/timedeltas.py:155: in __new__
    tdarr = TimedeltaArray._from_sequence_not_strict(
/usr/share/miniconda/envs/xarray-tests/lib/python3.9/site-packages/pandas/core/arrays/timedeltas.py:250: in _from_sequence_not_strict
    data, inferred_freq = sequence_to_td64ns(data, copy=copy, unit=unit)
/usr/share/miniconda/envs/xarray-tests/lib/python3.9/site-packages/pandas/core/arrays/timedeltas.py:957: in sequence_to_td64ns
    data = objects_to_td64ns(data, unit=unit, errors=errors)
/usr/share/miniconda/envs/xarray-tests/lib/python3.9/site-packages/pandas/core/arrays/timedeltas.py:1067: in objects_to_td64ns
    result = array_to_timedelta64(values, unit=unit, errors=errors)
pandas/_libs/tslibs/timedeltas.pyx:269: in pandas._libs.tslibs.timedeltas.array_to_timedelta64
    ???
pandas/_libs/tslibs/timedeltas.pyx:222: in pandas._libs.tslibs.timedeltas.convert_to_timedelta64
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   OverflowError: Python int too large to convert to C long

pandas/_libs/tslibs/timedeltas.pyx:167: OverflowError

This seems to coincide with the release of pandas=1.2.4, and this is indeed the only difference in the environment (I didn't try to reproduce, though).

cc @spencerkclark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants