import pandas as pd
Classwork 2
Pandas Basics - Loading, Summarizing, Selecting, Counting, 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.
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 todatetimes
?
Answer:
Question 2
How can we set the DataFrame
index to store the player names?
Answer:
Question 3
- How many observations are in
nfl
? - What are the mean, median, standard deviation, minimum, and maximum of
Salary
innfl
?
Answer:
Question 4
- How can we count the number of players per team in
nfl
? - How many unique teams are in
nfl
?
Answer:
Question 5
- Who are the five highest-paid players?
- Who is the oldest player?
Answer:
Question 6
How can we sort the DataFrame
first by Team
in alphabetical order and then by Salary
in descending order?
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 2 Discussion Board! 👋
This space is designed for you to engage with your classmates about the material covered in Classwork 2.
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 2 materials or need clarification on any points, don’t hesitate to ask here.
Let’s collaborate and learn from each other!