Introducing pandas Series, pandas DataFrames, and pandas Indexes
pandas Series, pandas DataFrames, and pandas Indexes are the fundamental pandas data structures.
pandas.Series
The pandas.Series
data structure represents a one-dimensional series of homogenous values (integer values, string values, double values, and so on). Series are a type of list and can contain only a single list with an index. A Data Frame, on the other hand, is a collection of one or more series.
Let's create a pandas.Series
data structure:
import pandas as pd ser1 = pd.Series(range(1, 6)); ser1
That series contains the index in the first column, and in the second column, the index's corresponding values:
0 1 1 2 2 3 3 4 4 5 dtype: int64
We can specify custom index names by specifying the index
parameter:
ser2 = pd.Series(range(1, 6), ...