6.1. Exercises
Practice Replacing Values
Instructions:
Running a coding exercise for the first time, could take a bit of time for everything to load. Be patient, it could take a few minutes.
When you see ____ in a coding exercise, replace it with what you assume to be the correct code. Run it and see if you obtain the desired output. Submit your code to validate if you were correct.
Let’s make a new column by assigning each pokemon base score as either “strong” or “weak”.
Tasks:
- Create a new column in the dataframe named
base_scoreby assigning values 500 or greater from the columntotal_bsas ‘strong’ pokemon and values less than 500 as ‘weak’ pokemon. - Display the first 10 rows of the dataframe.
Using the new column base_score we made above, make a bar graph showing the frequency of the strong and weak pokemon.
Tasks:
- Create an object using single brackets to obtain the column
base_scoreand name itbs_column. - Plot the object
bs_columnusing.mark_bar()and save this graph asscore_plot.