pyramid.utils.as_series

pyramid.utils.as_series(x)[source][source]

Cast as pandas Series.

Cast an iterable to a Pandas Series object. Note that the index will simply be a positional arange and cannot be set in this function.

Parameters:

x : array-like, shape=(n_samples,)

The 1d array on which to compute the auto correlation.

Returns:

s : pd.Series

A pandas Series object.

Examples

>>> as_series([1, 2, 3])
0    1
1    2
2    3
dtype: int64
>>> as_series(as_series((1, 2, 3)))
0    1
1    2
2    3
dtype: int64
>>> import pandas as pd
>>> as_series(pd.Series([4, 5, 6], index=['a', 'b', 'c']))
a    4
b    5
c    6
dtype: int64