- API reference
- Series
- pandas.Flags
pandas.Flags#
- classpandas.Flags(obj,*,allows_duplicate_labels)[source]#
Flags that apply to pandas objects.
- Parameters:
- objSeries or DataFrame
The object these flags are associated with.
- allows_duplicate_labelsbool, default True
Whether to allow duplicate labels in this object. By default,duplicate labels are permitted. Setting this to
False
willcause anerrors.DuplicateLabelError
to be raised whenindex (or columns for DataFrame) is not unique, or anysubsequent operation on introduces duplicates.SeeDisallowing Duplicate Labels for more.Warning
This is an experimental feature. Currently, many methods fail topropagate the
allows_duplicate_labels
value. In future versionsit is expected that every method taking or returning one or moreDataFrame or Series objects will propagateallows_duplicate_labels
.
Examples
Attributes can be set in two ways:
>>>df=pd.DataFrame()>>>df.flags<Flags(allows_duplicate_labels=True)>>>>df.flags.allows_duplicate_labels=False>>>df.flags<Flags(allows_duplicate_labels=False)>
>>>df.flags['allows_duplicate_labels']=True>>>df.flags<Flags(allows_duplicate_labels=True)>
Attributes
allows_duplicate_labels
Whether this object allows duplicate labels.
Methods