Pandas Series
Learn all about Pandas Series in this comprehensive tutorial.
- •A Pandas Series is like a column in a table.
- •If nothing else is specified, the values are labeled with their index number.
- •With the index argument, you can name your own labels.
- •You can also use a key/value object, like a dictionary, when creating a Series.
- •Data sets in Pandas are usually multi-dimensional tables, called DataFrames.
What is a Series?
A Pandas Series is like a column in a table.
It is a one-dimensional array holding data of any type.
Labels
If nothing else is specified, the values are labeled with their index number. First value has index 0, second value has index 1 etc.
This label can be used to access a specified value.
Create Labels
With the index argument, you can name your own labels.
When you have created labels, you can access an item by referring to the label.
Key/Value Objects as Series
You can also use a key/value object, like a dictionary, when creating a Series.
To select only some of the items in the dictionary, use the index argument and specify only the items you want to include in the Series.
DataFrames
Data sets in Pandas are usually multi-dimensional tables, called DataFrames.
Series is like a column, a DataFrame is the whole table.
You will learn about DataFrames in the next chapter.
Module quiz
2 questionsWhich of the following is true about Pandas Series?
What is the most common pitfall when working with Pandas Series?
Answer all questions to submit.