MCPcopy
hub / github.com/pandas-dev/pandas / test_preserve_category

Method test_preserve_category

pandas/tests/reshape/test_melt.py:313–321  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

311 tm.assert_frame_equal(result, expected)
312
313 def test_preserve_category(self):
314 # GH 15853
315 data = DataFrame({"A": [1, 2], "B": pd.Categorical(["X", "Y"])})
316 result = melt(data, ["B"], ["A"])
317 expected = DataFrame(
318 {"B": pd.Categorical(["X", "Y"]), "variable": ["A", "A"], "value": [1, 2]}
319 )
320
321 tm.assert_frame_equal(result, expected)
322
323 def test_melt_missing_columns_raises(self):
324 # GH-23575

Callers

nothing calls this directly

Calls 2

DataFrameClass · 0.90
meltFunction · 0.90

Tested by

no test coverage detected