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), Â Â Â Â Â ...