Skip to content

ds.notnull() fails with AttributeError on pandas 0.21.0rc1 #1663

Closed
@gerritholl

Description

@gerritholl

xarray.Dataset({"A": ("x", arange(5))}).notnull() fails with an 'AttributeError' when using numpy 1.13.3, xarray 0.9.6, and pandas 0.21.0rc1. The AttributeError is raised by pandas; see below.

$ cat mwe.py
#!/usr/bin/env python3.6

import numpy
print(numpy.__version__)
import xarray
print(xarray.__version__)
import pandas
print(pandas.__version__)

xarray.Dataset({"A": ("x", numpy.arange(5))}).notnull()
$ ./mwe.py
1.13.3
0.9.6
0.21.0rc1
Traceback (most recent call last):
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/xarray/core/ops.py", line 193, in func
    return getattr(self, name)(*args, **kwargs)
AttributeError: 'Variable' object has no attribute 'notna'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./mwe.py", line 10, in <module>
    xarray.Dataset({"A": ("x", numpy.arange(5))}).notnull()
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/xarray/core/dataset.py", line 2485, in func
    ds._variables[k] = f(self._variables[k], *args, **kwargs)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/xarray/core/ops.py", line 195, in func
    return f(self, *args, **kwargs)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pandas/core/dtypes/missing.py", line 212, in notna
    res = isna(obj)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pandas/core/dtypes/missing.py", line 45, in isna
    return _isna(obj)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pandas/core/dtypes/missing.py", line 60, in _isna_new
    return obj._constructor(obj._data.isna(func=isna))
AttributeError: 'Variable' object has no attribute '_constructor'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions