home / github / pull_requests

Menu
  • Search all tables
  • GraphQL API

pull_requests: 586244249

This data as json

id node_id number state locked title user body created_at updated_at closed_at merged_at merge_commit_sha assignee milestone draft head base author_association auto_merge repo url merged_by
586244249 MDExOlB1bGxSZXF1ZXN0NTg2MjQ0MjQ5 5006 closed 0 Adapt exception handling logic in CFTimeIndex.__sub__ and __rsub__ 6628425 The exception that was raised in pandas when a `datetime.timedelta` object outside the range that could be expressed in units of nanoseconds was passed to the `pandas.TimedeltaIndex` constructor changed from an `OverflowError` to an `OutOfBoundsTimedelta` error in the development version of pandas. This PR adjusts our exception handling logic in `CFTimeIndex.__sub__` and `CFTimeIndex.__rsub__` to account for this. - [x] closes #4947 <details> Previous versions of pandas: ```python >>> import pandas as pd; from datetime import timedelta >>> pd.TimedeltaIndex([timedelta(days=300 * 365)]) Traceback (most recent call last): File "pandas/_libs/tslibs/timedeltas.pyx", line 263, in pandas._libs.tslibs.timedeltas.array_to_timedelta64 TypeError: Expected unicode, got datetime.timedelta During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/spencer/Software/miniconda3/envs/xarray-tests/lib/python3.7/site-packages/pandas/core/indexes/timedeltas.py", line 157, in __new__ data, freq=freq, unit=unit, dtype=dtype, copy=copy File "/Users/spencer/Software/miniconda3/envs/xarray-tests/lib/python3.7/site-packages/pandas/core/arrays/timedeltas.py", line 216, in _from_sequence data, inferred_freq = sequence_to_td64ns(data, copy=copy, unit=unit) File "/Users/spencer/Software/miniconda3/envs/xarray-tests/lib/python3.7/site-packages/pandas/core/arrays/timedeltas.py", line 926, in sequence_to_td64ns data = objects_to_td64ns(data, unit=unit, errors=errors) File "/Users/spencer/Software/miniconda3/envs/xarray-tests/lib/python3.7/site-packages/pandas/core/arrays/timedeltas.py", line 1036, in objects_to_td64ns result = array_to_timedelta64(values, unit=unit, errors=errors) File "pandas/_libs/tslibs/timedeltas.pyx", line 268, in pandas._libs.tslibs.timedeltas.array_to_timedelta64 File "pandas/_libs/tslibs/timedeltas.pyx", line 221, in pandas._libs.tslibs.timedeltas.convert_to_timedelta64 File "pandas/_libs/tslibs/timedeltas.pyx", line 166, in pandas._libs.tslibs.timedeltas.delta_to_nanoseconds OverflowError: Python int too large to convert to C long ``` Development version of pandas: ```python >>> import pandas as pd; from datetime import timedelta >>> pd.TimedeltaIndex([timedelta(days=300 * 365)]) Traceback (most recent call last): File "pandas/_libs/tslibs/timedeltas.pyx", line 348, in pandas._libs.tslibs.timedeltas.array_to_timedelta64 TypeError: Expected unicode, got datetime.timedelta During handling of the above exception, another exception occurred: Traceback (most recent call last): File "pandas/_libs/tslibs/timedeltas.pyx", line 186, in pandas._libs.tslibs.timedeltas.delta_to_nanoseconds OverflowError: Python int too large to convert to C long The above exception was the direct cause of the following exception: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/spencer/software/pandas/pandas/core/indexes/timedeltas.py", line 161, in __new__ tdarr = TimedeltaArray._from_sequence_not_strict( File "/Users/spencer/software/pandas/pandas/core/arrays/timedeltas.py", line 270, in _from_sequence_not_strict data, inferred_freq = sequence_to_td64ns(data, copy=copy, unit=unit) File "/Users/spencer/software/pandas/pandas/core/arrays/timedeltas.py", line 970, in sequence_to_td64ns data = objects_to_td64ns(data, unit=unit, errors=errors) File "/Users/spencer/software/pandas/pandas/core/arrays/timedeltas.py", line 1079, in objects_to_td64ns result = array_to_timedelta64(values, unit=unit, errors=errors) File "pandas/_libs/tslibs/timedeltas.pyx", line 362, in pandas._libs.tslibs.timedeltas.array_to_timedelta64 File "pandas/_libs/tslibs/timedeltas.pyx", line 353, in pandas._libs.tslibs.timedeltas.array_to_timedelta64 File "pandas/_libs/tslibs/timedeltas.pyx", line 306, in pandas._libs.tslibs.timedeltas.convert_to_timedelta64 File "pandas/_libs/tslibs/timedeltas.pyx", line 189, in pandas._libs.tslibs.timedeltas.delta_to_nanoseconds pandas._libs.tslibs.conversion.OutOfBoundsTimedelta: Python int too large to convert to C long ``` </details> 2021-03-07T12:28:25Z 2021-03-07T13:22:06Z 2021-03-07T13:22:03Z 2021-03-07T13:22:03Z b610a3c4317474b4b999c23cf66d1dc55c9b3cd6     0 a62bd7b23ed0410a16dace8f9193a4659d1733c5 67903ff08ec9ea1b5c259df634dc65444ae97eb6 MEMBER   13221727 https://github.com/pydata/xarray/pull/5006  

Links from other tables

  • 0 rows from pull_requests_id in labels_pull_requests
Powered by Datasette · Queries took 1.093ms