On this page
pandas.Flags.allows_duplicate_labels
- propertyFlags.allows_duplicate_labels[source]
-
Whether this object allows duplicate labels.
Setting
allows_duplicate_labels=False
ensures that the index (and columns of a DataFrame) are unique. Most methods that accept and return a Series or DataFrame will propagate the value ofallows_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]
-
© 2008–2022, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.5.0/reference/api/pandas.Flags.allows_duplicate_labels.html