diff --git a/pandas/core/generic.py b/pandas/core/generic.py index f376518d4d3b8..874ab1a3c944d 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -406,6 +406,12 @@ def set_flags( """ Return a new object with updated flags. + This method creates a shallow copy of the original object, preserving its + underlying data while modifying its global flags. In particular, it allows + you to update properties such as whether duplicate labels are permitted. This + behavior is especially useful in method chains, where one wishes to + adjust DataFrame or Series characteristics without altering the original object. + Parameters ---------- copy : bool, default False