xorbits.pandas.DataFrame.set_flags#

DataFrame.set_flags(*, copy: bool_t = False, allows_duplicate_labels: bool_t | None = None) Self#

Return a new object with updated flags.

参数
  • copy (bool, default False) – Specify if a copy of the object should be made.

  • allows_duplicate_labels (bool, optional) – Whether the returned object allows duplicate labels.

返回

The same type as the caller.

返回类型

Series or DataFrame

参见

DataFrame.attrs

Global metadata applying to this dataset.

DataFrame.flags

Global flags applying to this object.

提示

This method returns a new object that’s a view on the same data as the input. Mutating the input or the output values will be reflected in the other.

This method is intended to be used in method chains.

“Flags” differ from “metadata”. Flags reflect properties of the pandas object (the Series or DataFrame). Metadata refer to properties of the dataset, and should be stored in DataFrame.attrs.

实际案例

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

警告

This method has not been implemented yet. Xorbits will try to execute it with pandas.

This docstring was copied from pandas.core.frame.DataFrame.