Series
The Series is the other fundamental pandas data structure. You can consider a DataFrame to be an organized collection of series, where each column is, in fact, a Series. Looking at the food_cons
column of the food_taste
DataFrame, you can see this relationship. The following line of code calls the type()
method on the food_cons
column of food_taste
:
type(food_taste['food_cons'])
This generates the following output:
pandas.core.series.Series
So, every DataFrame column is a pandas Series, once separated and on its own. This would also be the case if you separated a single row from a DataFrame. Recall that you can use ?
in Jupyter to get the help documentation. Try to do that and look at the first part of the Series documentation. You can use the following code to get the documentation:
?pd.Series
This provides the following output (truncated for brevity):