pandas 1.4.2

NotesParametersReturns
set_flags(self: 'NDFrameT', *, copy: 'bool_t' = False, allows_duplicate_labels: 'bool_t | None' = None) -> 'NDFrameT'

Notes

This method returns a new object that's a view on the same data as the input. Mutating the input or the output values will be reflected in the other.

This method is intended to be used in method chains.

"Flags" differ from "metadata". Flags reflect properties of the pandas object (the Series or DataFrame). Metadata refer to properties of the dataset, and should be stored in DataFrame.attrs .

Parameters

allows_duplicate_labels : bool, optional

Whether the returned object allows duplicate labels.

Returns

Series or DataFrame

The same type as the caller.

Return a new object with updated flags.

See Also

DataFrame.attrs

Global metadata applying to this dataset.

DataFrame.flags

Global flags applying to this object.

Examples

This example is valid syntax, but we were not able to check execution
>>> df = pd.DataFrame({"A": [1, 2]})
... df.flags.allows_duplicate_labels True
This example is valid syntax, but we were not able to check execution
>>> df2 = df.set_flags(allows_duplicate_labels=False)
... df2.flags.allows_duplicate_labels False
See :

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/generic.py#390
type: <class 'function'>
Commit: