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

Instruction

Good job. Series are very convenient when we want to perform an operation on all elements in a certain way. Consider this example:

magic_numbers = pd.Series([100, 200, 300, 400, 500, 600])
magic_numbers/10

The code above will divide every element of magic_numbers by 10. This means we will get

[10.0, 20.0, 30.0, 40.0, 50.0, 60.0]

Note that because of division, the elements were converted to floats (i.e. fractions - numbers with decimal points).

Exercise

Add five to all elements of the respondents_age Series.

Stuck? Here's a hint!

Simply write:

respondents_age + 5
on a new line.