pandas.api.types.union_categoricals
pandas 3.1.1 · Arrays, scalars, and data types · function
Combine categorical values, forming a category set that can represent the combined result.
Call syntax
pd.api.types.union_categoricals(to_union, sort_categories=False, ignore_order=False)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
to_union |
Required Positional or keyword |
list-like |
sort_categories |
Optional Positional or keyword Default False |
bool |
ignore_order |
Optional Positional or keyword Default False |
bool |
Returns
Categorical