home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 339730597

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/1662#issuecomment-339730597 https://api.github.com/repos/pydata/xarray/issues/1662 339730597 MDEyOklzc3VlQ29tbWVudDMzOTczMDU5Nw== 1217238 2017-10-26T16:56:03Z 2017-10-26T16:56:03Z MEMBER

I'm pretty sure this used to work in some form. I definitely worked with a dataset in the infancy of xarray that had coordinates with missing times.

The current issue appears to be that pandas represents the NaT values as an integer, and then (predictably) suffers from numeric overflow: ``` In [8]: import pandas as pd

In [9]: pd.to_timedelta(['24658 days 11:15:00', 'NaT']) + pd.Timestamp('1950-01-01')

OverflowError Traceback (most recent call last) <ipython-input-9-cc287bf4c401> in <module>() ----> 1 pd.to_timedelta(['24658 days 11:15:00', 'NaT']) + pd.Timestamp('1950-01-01')

~/conda/envs/xarray-py36/lib/python3.6/site-packages/pandas/core/indexes/datetimelike.py in add(self, other) 658 return self.shift(other) 659 elif isinstance(other, (Timestamp, datetime)): --> 660 return self._add_datelike(other) 661 else: # pragma: no cover 662 return NotImplemented

~/conda/envs/xarray-py36/lib/python3.6/site-packages/pandas/core/indexes/timedeltas.py in _add_datelike(self, other) 354 other = Timestamp(other) 355 i8 = self.asi8 --> 356 result = checked_add_with_arr(i8, other.value) 357 result = self._maybe_mask_results(result, fill_value=iNaT) 358 return DatetimeIndex(result, name=self.name, copy=False)

~/conda/envs/xarray-py36/lib/python3.6/site-packages/pandas/core/algorithms.py in checked_add_with_arr(arr, b, arr_mask, b_mask) 889 890 if to_raise: --> 891 raise OverflowError("Overflow in int64 addition") 892 return arr + b 893

OverflowError: Overflow in int64 addition ```

This appears to be specific to our use of a TimedeltaIndex. Overflow doesn't appear if you add either value as scalars: ``` In [11]: pd.NaT + pd.Timestamp('1950-01-01') Out[11]: NaT

In [12]: pd.Timedelta('24658 days 11:15:00') + pd.Timestamp('1950-01-01') Out[12]: Timestamp('2017-07-06 11:15:00') ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  268725471
Powered by Datasette · Queries took 3.221ms · About: xarray-datasette