import pandas as pd
Homework 2
Pandas Basics - Loading, Summarizing, Selecting, Counting, and Sorting Data
Direction
Please submit your Jupyter Notebook for Homework 2 to the Brightspace with the name below:
danl-m1-hw2-LASTNAME-FIRSTNAME.ipynb
( e.g.,danl-m2-hw2-choe-byeonghak.ipynb
)
The due is February 20, 2024, 7:00 P.M.
Please send Byeong-Hak an email (
bchoe@geneseo.edu
) if you have any questions.Please prepare a Jupyter/Python Notebook (
*.ipynb
) to address all questions.Make at least some simple comment (
# ...
) in each question.Make one text cell to explain things in each question.
Load Libraries
Import the pandas
library.
Below is nhl
DataFrame
that reads the file NHL-1617.csv
containing data of all non-goalie NHL players who had at least some ice time, i.e. playing time, in the 2016/2017 regular season - without play-offs.
= pd.read_csv('https://bcdanl.github.io/data/NHL-1617.csv') nhl
Variable Description
id_player
: Player IDBorn
: Date of BirthCity
: City of BirthCntry
: Country of BirthNat
: NationalityLast_Name
: Last nameFirst_name
: First NamePosition
: PositionTeam
: TeamGP
: The number of gamesG
: The number of goalsA
: The number of assistsTOI
: The total time on ice (in second)TOI_GP
: Average amount of playing time per game (in minute)
Question 1
How many players had at least some ice time?
Answer
Question 2
Who is the top scorer in terms of goals?
Answer
Question 3
How can we count the number of NHL players for each country?
Answer
Question 4
- How many unique countries are in
nhl.csv
?
Answer
Question 5
Which three nationalities have the highest number of players?
Answer