Classwork 10

Pandas Fundamental I: Loading, Summarizing, and Counting Data

Author

Byeong-Hak Choe

Published

March 27, 2026

Modified

March 30, 2026

Direction

The nfl.csv file (with its pathname https://bcdanl.github.io/data/nfl.csv) contains a list of players in the National Football League with similar Name, Team, Position, Birthday, and Salary variables in the nba.csv file.



Question 1

  • How can we read the nfl.csv file, and assign it to a DataFrame object, nfl?
  • What is an effective way to convert the values in its Birthday variable to datetimes?

Answer:


Question 2

  • How many observations are in nfl?
  • What are the mean, median, standard deviation, minimum, and maximum of Salary in nfl?

Answer:


Question 3

  • What are the maximum and minimum values of Salary in nfl?
  • What is the 75th percentile of Salary in nfl?

Answer:


Question 4

  • Create a new Series that concatenates each player’s Name and Position in the format Name (Position) using a vectorized string operation.
  • Create a new Series that shows how much each player’s Salary deviates from the mean salary.

Answer:


Question 5

  • How can we select only the Name and Team variables from nfl as a DataFrame?
  • How can we reorder the variables so that Team appears before Name?

Answer:


Question 6

  • Add a new variable Salary_k to nfl that expresses Salary in thousands of dollars.
  • Add another new variable Salary_2x to nfl that doubles the original Salary.

Answer:


Question 7

  • Remove the variables Salary_k and Salary_2x from nfl.

Answer:


Question 8

  • Rename the variable Birthday to Date of Birth in nfl.

Answer:


Question 9

  • How can we count the number of players per team in nfl?
  • How many players are there per position in nfl?

Answer:


Question 10

  • How many unique teams are in nfl?
  • How many unique positions are in nfl?

Answer:




Discussion

Welcome to our Classwork 10 Discussion Board! 👋

This space is designed for you to engage with your classmates about the material covered in Classwork 10.

Whether you are looking to delve deeper into the content, share insights, or have questions about the content, this is the perfect place for you.

If you have any specific questions for Byeong-Hak (@bcdanl) regarding the Classwork 10 materials or need clarification on any points, don’t hesitate to ask here.

All comments will be stored here.

Let’s collaborate and learn from each other!

Back to top