Skip to content

Commit

Permalink
Backport PR pandas-dev#56949: CI: avoid FutureWarnings in to_xarray t…
Browse files Browse the repository at this point in the history
…ests
  • Loading branch information
lukemanley authored and meeseeksmachine committed Jan 19, 2024
1 parent a95029a commit 57cfdb6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pandas/tests/generic/test_to_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_to_xarray_index_types(self, index_flat, df, using_infer_string):
df.index.name = "foo"
df.columns.name = "bar"
result = df.to_xarray()
assert result.dims["foo"] == 4
assert result.sizes["foo"] == 4
assert len(result.coords) == 1
assert len(result.data_vars) == 8
tm.assert_almost_equal(list(result.coords.keys()), ["foo"])
Expand All @@ -62,7 +62,7 @@ def test_to_xarray_empty(self, df):

df.index.name = "foo"
result = df[0:0].to_xarray()
assert result.dims["foo"] == 0
assert result.sizes["foo"] == 0
assert isinstance(result, Dataset)

def test_to_xarray_with_multiindex(self, df, using_infer_string):
Expand All @@ -71,8 +71,8 @@ def test_to_xarray_with_multiindex(self, df, using_infer_string):
# MultiIndex
df.index = MultiIndex.from_product([["a"], range(4)], names=["one", "two"])
result = df.to_xarray()
assert result.dims["one"] == 1
assert result.dims["two"] == 4
assert result.sizes["one"] == 1
assert result.sizes["two"] == 4
assert len(result.coords) == 2
assert len(result.data_vars) == 8
tm.assert_almost_equal(list(result.coords.keys()), ["one", "two"])
Expand Down

0 comments on commit 57cfdb6

Please sign in to comment.