cudf.Series.set_flags#

Series.set_flags(
*,
copy: bool = False,
allows_duplicate_labels: bool | None = None,
) Self[source]#

Return a new object with updated flags.

Parameters:
copybool, default False

Specify if a copy of the object should be made. The default value is preserved for compatibility with pandas.

allows_duplicate_labelsbool, optional

Whether the returned object allows duplicate labels.

Returns:
Series or DataFrame

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. The returned object will have flags.allows_duplicate_labels set to the value passed. Unlike the pandas version, the default of copy=False does not share memory between the two objects because cudf backs all operations with copy-on-write buffers.

Examples

>>> import cudf
>>> df = cudf.DataFrame({"A": [1, 2]})
>>> df.flags.allows_duplicate_labels
True
>>> df2 = df.set_flags(allows_duplicate_labels=False)
>>> df2.flags.allows_duplicate_labels
False