pandas 1.4.2

ParametersReturnsBackRef
factorize_array(values: 'np.ndarray', na_sentinel: 'int' = -1, size_hint: 'int | None' = None, na_value=None, mask: 'np.ndarray | None' = None) -> 'tuple[npt.NDArray[np.intp], np.ndarray]'

This doesn't do any coercion of types or unboxing before factorization.

Parameters

values : ndarray
na_sentinel : int, default -1
size_hint : int, optional

Passed through to the hashtable's 'get_labels' method

na_value : object, optional

A value in :None:None:`values` to consider missing. Note: only use this parameter when you know that you don't have any values pandas would consider missing in the array (NaN for float data, iNaT for datetimes, etc.).

mask : ndarray[bool], optional

If not None, the mask is used as indicator for missing values (True = missing, False = valid) instead of :None:None:`na_value` or condition "val != val".

Returns

codes : ndarray[np.intp]
uniques : ndarray

Factorize a numpy array to codes and uniques.

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.reshape.merge._factorize_keys

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/algorithms.py#524
type: <class 'function'>
Commit: