Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Series
4. Series basics
What DataFrames are
DataFrame columns
DataFrame rows
Filtering rows and columns
Filtering data frames
Sorting rows
Summary

Instruction

Good job! We already know a few basic data types in Python: strings, numbers, and lists. Pandas introduces new data structures, such as Series and DataFrame. Most of the time, we will work with DataFrames. However, DataFrames are based on Series, so we'll briefly introduce those as well.

A Series is a one-dimensional object that resembles a list in Python or a column in a table. Each value in a Series has its own index. Let's take a look at a Series.

invited_guests = pd.Series(['John', 'Tim', 'Kate', 'Mark'])

Exercise

Look at the template code. We imported pandas and created a new Series with the names of guests we invited to a party. To create a Series, use the pd.Series() function and pass in a regular Python list as an argument.

You can see that each name of the list has been given an index, starting with 0. Unlike with lists, an index in a Series is explicitly shown along with the contents of the Series.

Just click the Run and check code button.