modin.pandas.Index.set_names

Index.set_names(names: Any, level: Any = None, inplace: bool = False) Index | None[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/modin/plugin/extensions/index.py#L459-L478)

Set Index name.

Able to set new names partially and by level.

Parameters:
  • names (label or list of label or dict-like for MultiIndex) – Name(s) to set.

  • level (int, label or list of int or label, optional) –

  • inplace (bool, default False) – Modifies the object directly, instead of creating a new Index.

Returns:

The same type as the caller or None if inplace=True.

Return type:

Index or None

Examples

>>> idx = pd.Index([1, 2, 3, 4])
>>> idx
Index([1, 2, 3, 4], dtype='int64')
>>> idx.set_names('quarter')
Index([1, 2, 3, 4], dtype='int64', name='quarter')
Copy
Language: English