Learn
Creating, Loading, and Selecting Data with Pandas
Select Rows

Let’s revisit our orders from ShoeFly.com:

id first_name last_name email shoe_type shoe_material shoe_color
54791 Rebecca Lindsay [email protected] clogs faux-leather black
53450 Emily James [email protected] ballet flats faux-leather navy
91987 Joyce Waller [email protected] sandals fabric black
14437 Justin Erickson [email protected] clogs faux-leather red

Maybe our Customer Service department has just received a message from Joyce Waller, so we want to know exactly what she ordered. We want to select this single row of data.

DataFrames are zero-indexed, meaning that we start with the 0th row and count up from there. Joyce Waller’s order is the 2nd row.

We select it using the following command:

orders.iloc[2]

When we select a single row, the result is a Series (just like when we select a single column).

Instructions

1.

You’re getting ready to staff the clinic for March this year. You want to know how many visits took place in March last year, to help you prepare.

Write a command that will produce a Series made up of the March data from df from all four clinic sites and save it to the variable march.

Folder Icon

Sign up to start coding

Already have an account?