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

Method test_concat

xarray/tests/test_indexes.py:389–405  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

387 )
388
389 def test_concat(self) -> None:
390 pd_midx = pd.MultiIndex.from_product(
391 [[0, 1, 2], ["a", "b"]], names=("foo", "bar")
392 )
393 level_coords_dtype = {"foo": np.int32, "bar": "=U1"}
394
395 midx1 = PandasMultiIndex(
396 pd_midx[:2], "x", level_coords_dtype=level_coords_dtype
397 )
398 midx2 = PandasMultiIndex(
399 pd_midx[2:], "x", level_coords_dtype=level_coords_dtype
400 )
401 expected = PandasMultiIndex(pd_midx, "x", level_coords_dtype=level_coords_dtype)
402
403 actual = PandasMultiIndex.concat([midx1, midx2], "x")
404 assert actual.equals(expected)
405 assert actual.level_coords_dtype == expected.level_coords_dtype
406
407 def test_stack(self) -> None:
408 prod_vars = {

Callers

nothing calls this directly

Calls 3

PandasMultiIndexClass · 0.90
concatMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected