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

Function _coerce_indexer_frozen

pandas/core/indexes/multi.py:4713–4733  ·  view source on GitHub ↗

Coerce the array-like indexer to the smallest integer dtype that can encode all of the given categories. Parameters ---------- array_like : array-like categories : array-like copy : bool Returns ------- np.ndarray Non-writeable.

(array_like, categories, copy: bool = False)

Source from the content-addressed store, hash-verified

4711
4712
4713def _coerce_indexer_frozen(array_like, categories, copy: bool = False) -> np.ndarray:
4714 """
4715 Coerce the array-like indexer to the smallest integer dtype that can encode all
4716 of the given categories.
4717
4718 Parameters
4719 ----------
4720 array_like : array-like
4721 categories : array-like
4722 copy : bool
4723
4724 Returns
4725 -------
4726 np.ndarray
4727 Non-writeable.
4728 """
4729 array_like = coerce_indexer_dtype(array_like, categories)
4730 if copy:
4731 array_like = array_like.copy()
4732 array_like.flags.writeable = False
4733 return array_like
4734
4735
4736def _require_listlike(level, arr, arrname: str):

Callers 1

_set_codesMethod · 0.85

Calls 2

coerce_indexer_dtypeFunction · 0.90
copyMethod · 0.45

Tested by

no test coverage detected