bigframes.pandas.Index.to_series#

Index.to_series(index:Index|None=None,name:Hashable|None=None)Series[source]#

Create a Series with both index and values equal to the index keys.

Useful with map for returning an indexer based on an index.

Examples:

>>>idx=bpd.Index(['Ant','Bear','Cow'],name='animal')

By default, the original index and original name is reused.

>>>idx.to_series()animalAnt      AntBear    BearCow      CowName: animal, dtype: string

To enforce a new index, specify new labels to index:

>>>idx.to_series(index=[0,1,2])0     Ant1    Bear2     CowName: animal, dtype: string

To override the name of the resulting column, specify name:

>>>idx.to_series(name='zoo')animalAnt      AntBear    BearCow      CowName: zoo, dtype: string
Parameters:
  • index (Index,optional) – Index of resulting Series. If None, defaults to original index.

  • name (str,optional) – Name of resulting Series. If None, defaults to name of originalindex.

Returns:

The dtype will be based on the type of the Index values.

Return type:

bigframes.pandas.Series

On this page

This Page