Return a new object with updated flags.
Specify if a copy of the object should be made.
Note
The copy keyword will change behavior in pandas 3.0. Copy-on-Write will be enabled by default, which means that all methods with a copy keyword will use a lazy copy mechanism to defer the copy and ignore the copy keyword. The copy keyword will be removed in a future version of pandas.
You can already get the future behavior and improvements through enabling copy on write pd.options.mode.copy_on_write = True
Whether the returned object allows duplicate labels.
The same type as the caller.
See also
DataFrame.attrs
Global metadata applying to this dataset.
DataFrame.flags
Global flags applying to this object.
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
.
Examples
>>> df = pd.DataFrame({"A": [1, 2]}) >>> df.flags.allows_duplicate_labels True >>> df2 = df.set_flags(allows_duplicate_labels=False) >>> df2.flags.allows_duplicate_labels False
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4