From 37e5ae7df590e33e1c1dfbfcded318dc50dddf26 Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Fri, 8 Nov 2019 15:33:06 +0000 Subject: [PATCH] fix pandas-dev tests (#3491) * Don't initialize DataArrays with Pandas attrs. * re-enable pandas-dev CI. --- ci/azure/install.yml | 2 +- xarray/core/dataarray.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ci/azure/install.yml b/ci/azure/install.yml index 8da0ac1b5de..fee886ba804 100644 --- a/ci/azure/install.yml +++ b/ci/azure/install.yml @@ -16,7 +16,7 @@ steps: --pre \ --upgrade \ matplotlib \ - pandas=0.26.0.dev0+628.g03c1a3db2 \ # FIXME https://github.com/pydata/xarray/issues/3440 + pandas \ scipy # numpy \ # FIXME https://github.com/pydata/xarray/issues/3409 pip install \ diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index d2d37871ee9..3e4c7903180 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -51,6 +51,7 @@ from .dataset import Dataset, merge_indexes, split_indexes from .formatting import format_item from .indexes import Indexes, default_indexes +from .merge import PANDAS_TYPES from .options import OPTIONS from .utils import Default, ReprObject, _check_inplace, _default, either_dict_or_kwargs from .variable import ( @@ -357,7 +358,7 @@ def __init__( dims = getattr(data, "dims", getattr(coords, "dims", None)) if name is None: name = getattr(data, "name", None) - if attrs is None: + if attrs is None and not isinstance(data, PANDAS_TYPES): attrs = getattr(data, "attrs", None) if encoding is None: encoding = getattr(data, "encoding", None)