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

Method test_factorize_multiindex_empty

pandas/tests/test_algos.py:585–593  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

583 tm.assert_index_equal(result, expected, exact=True)
584
585 def test_factorize_multiindex_empty(self):
586 # GH#57517
587 mi = MultiIndex.from_product(
588 [Index([], name="a", dtype=object), Index([], name="i", dtype="f4")]
589 )
590 codes, uniques = mi.factorize()
591 exp_codes = np.array([], dtype=np.intp)
592 tm.assert_numpy_array_equal(codes, exp_codes)
593 tm.assert_index_equal(uniques, mi[:0])
594
595 def test_dtype_preservation(self, any_numpy_dtype):
596 # GH 15442

Callers

nothing calls this directly

Calls 4

IndexClass · 0.90
from_productMethod · 0.80
factorizeMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected