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

Method test_to_dataframe_0length

xarray/tests/test_dataarray.py:3725–3735  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3723 assert expected_df.equals(actual_df)
3724
3725 def test_to_dataframe_0length(self) -> None:
3726 # regression test for #3008
3727 arr_np = np.random.randn(4, 0)
3728
3729 mindex = pd.MultiIndex.from_product([[1, 2], list("ab")], names=["A", "B"])
3730
3731 arr = DataArray(arr_np, [("MI", mindex), ("C", [])], name="foo")
3732
3733 actual = arr.to_dataframe()
3734 assert len(actual) == 0
3735 assert_array_equal(actual.index.names, list("ABC"))
3736
3737 @pytest.mark.parametrize(
3738 "x_dtype,y_dtype,v_dtype",

Callers

nothing calls this directly

Calls 2

to_dataframeMethod · 0.95
DataArrayClass · 0.90

Tested by

no test coverage detected