Course Content
Introduction to Python for Data Analysis
Introduction to Python for Data Analysis
Recall Loops
Imagine that you want to count how many 'Data Scientist' jobs are in the dataset. You are already familiar with the loops and if/else statements. Try it.
Task
Follow the algorithm:
- Create a
for
loop that iterates through the'job_title'
column in thedf
. - Within the
for
loop, implement theif
statement that checks ifi
is equal to'Data Scientist'
. - Within the
if
statement, increase thecount
variable by 1.
In this chapter, you count values in a straightforward but irrational way. Imagine that you have thousands of rows in the dataset; such a loop may take even an hour to process, depending on the dataset's size and the computer's power. Thus, in the next section, you will learn how to do the same thing but in a way that
pandas
offer you.
Thanks for your feedback!
Recall Loops
Imagine that you want to count how many 'Data Scientist' jobs are in the dataset. You are already familiar with the loops and if/else statements. Try it.
Task
Follow the algorithm:
- Create a
for
loop that iterates through the'job_title'
column in thedf
. - Within the
for
loop, implement theif
statement that checks ifi
is equal to'Data Scientist'
. - Within the
if
statement, increase thecount
variable by 1.
In this chapter, you count values in a straightforward but irrational way. Imagine that you have thousands of rows in the dataset; such a loop may take even an hour to process, depending on the dataset's size and the computer's power. Thus, in the next section, you will learn how to do the same thing but in a way that
pandas
offer you.
Thanks for your feedback!
Recall Loops
Imagine that you want to count how many 'Data Scientist' jobs are in the dataset. You are already familiar with the loops and if/else statements. Try it.
Task
Follow the algorithm:
- Create a
for
loop that iterates through the'job_title'
column in thedf
. - Within the
for
loop, implement theif
statement that checks ifi
is equal to'Data Scientist'
. - Within the
if
statement, increase thecount
variable by 1.
In this chapter, you count values in a straightforward but irrational way. Imagine that you have thousands of rows in the dataset; such a loop may take even an hour to process, depending on the dataset's size and the computer's power. Thus, in the next section, you will learn how to do the same thing but in a way that
pandas
offer you.
Thanks for your feedback!
Imagine that you want to count how many 'Data Scientist' jobs are in the dataset. You are already familiar with the loops and if/else statements. Try it.
Task
Follow the algorithm:
- Create a
for
loop that iterates through the'job_title'
column in thedf
. - Within the
for
loop, implement theif
statement that checks ifi
is equal to'Data Scientist'
. - Within the
if
statement, increase thecount
variable by 1.
In this chapter, you count values in a straightforward but irrational way. Imagine that you have thousands of rows in the dataset; such a loop may take even an hour to process, depending on the dataset's size and the computer's power. Thus, in the next section, you will learn how to do the same thing but in a way that
pandas
offer you.