MCPcopy Index your code
hub / github.com/pydata/xarray / test_sel_categorical

Method test_sel_categorical

xarray/tests/test_dataset.py:1870–1876  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1868 )
1869
1870 def test_sel_categorical(self) -> None:
1871 ind = pd.Series(["foo", "bar"], dtype="category")
1872 df = pd.DataFrame({"ind": ind, "values": [1, 2]})
1873 ds = df.set_index("ind").to_xarray()
1874 actual = ds.sel(ind="bar")
1875 expected = ds.isel(ind=1)
1876 assert_identical(expected, actual)
1877
1878 def test_sel_categorical_error(self) -> None:
1879 ind = pd.Series(["foo", "bar"], dtype="category")

Callers

nothing calls this directly

Calls 4

assert_identicalFunction · 0.90
set_indexMethod · 0.45
selMethod · 0.45
iselMethod · 0.45

Tested by

no test coverage detected