Classwork 5

Pandas Basics - Loading, Summarizing, Selecting, Counting, Sorting, and Indexing Data

Author

Byeong-Hak Choe

Published

February 12, 2025

Modified

February 12, 2025

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

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

Answer:


Question 4

  • Who are the five highest-paid players?
  • Who is the oldest player?

Answer:


Question 5

How can we sort the DataFrame first by Team in alphabetical order and then by Salary in descending order?

Answer:


Question 6

How do we set the player names as the DataFrame index?

Answer:


Question 7

Who is the oldest player on the Kansas City Chiefs roster, and what is his birthday?

Answer:


Discussion

Welcome to our Classwork 5 Discussion Board! 👋

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

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 5 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