Skip to content

Commit

Permalink
Backport PR #56949 on branch 2.2.x (CI: avoid FutureWarnings in to_xa…
Browse files Browse the repository at this point in the history
…rray tests) (#56961)

Backport PR #56949: CI: avoid FutureWarnings in to_xarray tests

Co-authored-by: Luke Manley <lukemanley@gmail.com>
  • Loading branch information
meeseeksmachine and lukemanley committed Jan 19, 2024
1 parent a95029a commit cc37a13
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pandas/tests/generic/test_to_xarray.py
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 cc37a13

Please sign in to comment.