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

Function factorize_from_iterables

pandas/core/arrays/categorical.py:3157–3182  ·  view source on GitHub ↗

A higher-level wrapper over `factorize_from_iterable`. Parameters ---------- iterables : list-like of list-likes Returns ------- codes : list of ndarrays categories : list of Indexes Notes ----- See `factorize_from_iterable` for more info.

(iterables)

Source from the content-addressed store, hash-verified

3155
3156
3157def factorize_from_iterables(iterables) -> tuple[list[np.ndarray], list[Index]]:
3158 """
3159 A higher-level wrapper over `factorize_from_iterable`.
3160
3161 Parameters
3162 ----------
3163 iterables : list-like of list-likes
3164
3165 Returns
3166 -------
3167 codes : list of ndarrays
3168 categories : list of Indexes
3169
3170 Notes
3171 -----
3172 See `factorize_from_iterable` for more info.
3173 """
3174 if len(iterables) == 0:
3175 # For consistency, it should return two empty lists.
3176 return [], []
3177
3178 codes, categories = zip(
3179 *(factorize_from_iterable(it) for it in iterables),
3180 strict=True,
3181 )
3182 return list(codes), list(categories)

Callers 3

_make_concat_multiindexFunction · 0.90
from_arraysMethod · 0.90
from_productMethod · 0.90

Calls 1

factorize_from_iterableFunction · 0.85

Tested by

no test coverage detected