pandas.Flags.allows_duplicate_labels#
- property Flags.allows_duplicate_labels#
- Whether this object allows duplicate labels. - Setting - allows_duplicate_labels=Falseensures that the index (and columns of a DataFrame) are unique. Most methods that accept and return a Series or DataFrame will propagate the value of- allows_duplicate_labels.- See Duplicate Labels for more. - See also - DataFrame.attrs
- Set global metadata on this object. 
- DataFrame.set_flags
- Set global flags on this object. 
 - Examples - >>> df = pd.DataFrame({"A": [1, 2]}, index=['a', 'a']) >>> df.flags.allows_duplicate_labels True >>> df.flags.allows_duplicate_labels = False Traceback (most recent call last): ... pandas.errors.DuplicateLabelError: Index has duplicates. positions label a [0, 1]