11.1. Exercises
Practicing Frequency Tables
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 get the frequencies of some of our values! We spoke in the slides about the steps we needed to follow to get a frequency table.
Tasks:
- Let’s make an object named
position_columnthat consists of just thePositioncolumn. Note we will be using this forvalue_countsso we must do this with only using single[]brackets. - Find the frequencies of the position for the hockey team using
.value_counts()and save it asposition_freq. - Export
position_freqto a csv namedposition_frequencies.csvusing.to_csv(). - Don’t forget to display it.
If you get a warning along with your output, that’s fine. We will explain why this happens further in the course.