filter(self: 'NDFrameT', items=None, like: 'str | None' = None, regex: 'str | None' = None, axis=None) -> 'NDFrameT'
Note that this routine does not filter a dataframe on its contents. The filter is applied to the labels of the index.
The items
, like
, and regex
parameters are enforced to be mutually exclusive.
axis
defaults to the info axis that is used when indexing with []
.
Keep labels from axis which are in items.
Keep labels from axis for which "like in label == True".
Keep labels from axis for which re.search(regex, label) == True.
The axis to filter on, expressed either as an index (int) or axis name (str). By default this is the info axis, 'index' for Series, 'columns' for DataFrame.
Subset the dataframe rows or columns according to the specified index labels.
DataFrame.loc
Access a group of rows and columns by label(s) or a boolean array.
>>> df = pd.DataFrame(np.array(([1, 2, 3], [4, 5, 6])),This example is valid syntax, but we were not able to check execution
... index=['mouse', 'rabbit'],
... columns=['one', 'two', 'three'])
... df one two three mouse 1 2 3 rabbit 4 5 6
>>> # select columns by nameThis example is valid syntax, but we were not able to check execution
... df.filter(items=['one', 'three']) one three mouse 1 3 rabbit 4 6
>>> # select columns by regular expressionThis example is valid syntax, but we were not able to check execution
... df.filter(regex='e$', axis=1) one three mouse 1 3 rabbit 4 6
>>> # select rows containing 'bbi'See :
... df.filter(like='bbi', axis=0) one two three rabbit 4 5 6
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