home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 563202971

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
563202971 MDExOlB1bGxSZXF1ZXN0MzczNjU1Mzg4 3764 Fix CFTimeIndex-related errors stemming from updates in pandas 6628425 closed 0     10 2020-02-11T13:22:04Z 2020-03-15T14:58:26Z 2020-03-13T06:14:41Z MEMBER   0 pydata/xarray/pulls/3764
  • [x] Closes #3751
  • [x] Tests added
  • [x] Passes isort -rc . && black . && mypy . && flake8
  • [x] Fully documented, including whats-new.rst for all changes and api.rst for new API

This fixes the errors identified when #3751 was created by allowing one to subtract a pd.Index of cftime.datetime objects from a CFTimeIndex.

Some new errors have come up too (not associated with any updates I made here), which I still need to work on identifying the source of: ``` ____ test_indexing_in_series_getitem[365_day] _____

series = 0001-01-01 00:00:00 1 0001-02-01 00:00:00 2 0002-01-01 00:00:00 3 0002-02-01 00:00:00 4 dtype: int64 index = CFTimeIndex([0001-01-01 00:00:00, 0001-02-01 00:00:00, 0002-01-01 00:00:00, 0002-02-01 00:00:00], dtype='object') scalar_args = [cftime.DatetimeNoLeap(0001-01-01 00:00:00)] range_args = ['0001', slice('0001-01-01', '0001-12-30', None), slice(None, '0001-12-30', None), slice(cftime.DatetimeNoLeap(0001-01...:00), cftime.DatetimeNoLeap(0001-12-30 00:00:00), None), slice(None, cftime.DatetimeNoLeap(0001-12-30 00:00:00), None)]

@requires_cftime
def test_indexing_in_series_getitem(series, index, scalar_args, range_args):
    for arg in scalar_args:
      assert series[arg] == 1

test_cftimeindex.py:597:


../../../pandas/pandas/core/series.py:884: in getitem return self._get_with(key)


self = 0001-01-01 00:00:00 1 0001-02-01 00:00:00 2 0002-01-01 00:00:00 3 0002-02-01 00:00:00 4 dtype: int64 key = cftime.DatetimeNoLeap(0001-01-01 00:00:00)

def _get_with(self, key):
    # other: fancy integer or otherwise
    if isinstance(key, slice):
        # _convert_slice_indexer to determing if this slice is positional
        #  or label based, and if the latter, convert to positional
        slobj = self.index._convert_slice_indexer(key, kind="getitem")
        return self._slice(slobj)
    elif isinstance(key, ABCDataFrame):
        raise TypeError(
            "Indexing a Series with DataFrame is not "
            "supported, use the appropriate DataFrame column"
        )
    elif isinstance(key, tuple):
        try:
            return self._get_values_tuple(key)
        except ValueError:
            # if we don't have a MultiIndex, we may still be able to handle
            #  a 1-tuple.  see test_1tuple_without_multiindex
            if len(key) == 1:
                key = key[0]
                if isinstance(key, slice):
                    return self._get_values(key)
            raise

    if not isinstance(key, (list, np.ndarray, ExtensionArray, Series, Index)):
      key = list(key)

E TypeError: 'cftime._cftime.DatetimeNoLeap' object is not iterable

../../../pandas/pandas/core/series.py:911: TypeError ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3764/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 pull

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 10 rows from issue in issue_comments
Powered by Datasette · Queries took 0.61ms · About: xarray-datasette