_factorize_keys(lk: 'ArrayLike', rk: 'ArrayLike', sort: 'bool' = True, how: 'str' = 'inner') -> 'tuple[npt.NDArray[np.intp], npt.NDArray[np.intp], int]'
This is used to get the join indexers to be used when merging DataFrames.
Left key.
Right key.
If True, the encoding is done such that the unique elements in the keys are sorted.
Type of merge.
Left (resp. right if called with :None:None:`key='right'`
) labels, as enumerated type.
Right (resp. left if called with :None:None:`key='right'`
) labels, as enumerated type.
Number of unique elements in union of left and right labels.
Encode left and right keys as enumerated types.
algorithms.factorize
Encode the object as an enumerated type or categorical variable.
merge
Merge DataFrame or named Series objects with a database-style join.
>>> lk = np.array(["a", "c", "b"])
... rk = np.array(["a", "c"])
Here, the unique values are :None:None:`'a', 'b', 'c'`
. With the default :None:None:`sort=True`
, the encoding will be :None:None:`{0: 'a', 1: 'b', 2: 'c'}`
:
>>> pd.core.reshape.merge._factorize_keys(lk, rk) (array([0, 2, 1]), array([0, 2]), 3)
With the :None:None:`sort=False`
, the encoding will correspond to the order in which the unique elements first appear: :None:None:`{0: 'a', 1: 'c', 2: 'b'}`
:
>>> pd.core.reshape.merge._factorize_keys(lk, rk, sort=False) (array([0, 1, 2]), array([0, 1]), 3)See :
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