Classwork 3

Pandas Basics - Sorting and Indexing Data

Author

Byeong-Hak Choe

Published

February 20, 2024

Modified

February 27, 2024

Part 1 - Sorting and Indexing Data

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 we used in class.

import pandas as pd



Question 1

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

Answer:


Question 2

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

Answer:


Question 3

How can we set the DataFrame index to store the player names?

Answer:


Question 4

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

Answer:


Discussion

Welcome to our Classwork 3 Discussion Board! 👋

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

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 3 materials or need clarification on any points, don’t hesitate to ask here.

Let’s collaborate and learn from each other!

Back to top