Skip to content
1 hidden cell
Introduction to Python
Python notes/Tools
1 hidden cell
data platforms web analytics
Microsoft PowerBI Google Analytics Power Virtual Agent MixPanel Alteryx Designer Amplitude Tableau, Snowflake Adobe Analytics Fivetran Snowflake ThoughtSpot Data Studio Excel Metabase Looker
Add your notes here
Create list areas
areas = [11.25, 18.0, 20.0, 10.75, 9.50]
Print out the index of the element 20.0
print(areas.index(20.0))
Print out how often 9.50 appears in areas
print(areas.count(9.50))
# Add your code snippets here
areas = [11.25, 18.0, 20.0, 10.75, 9.50]
print(areas.index(20.0))
print(areas.count(9.50))
Explore Datasets
Use the arrays imported in the first cell to explore the data and practice your skills!
- Print out the weight of the first ten baseball players.
- What is the median weight of all baseball players in the data?
- Print out the names of all players with a height greater than 80 (heights are in inches).
- Who is taller on average? Baseball players or soccer players? Keep in mind that baseball heights are stored in inches!
- The values in
soccer_shooting
are decimals. Convert them to whole numbers (e.g., 0.98 becomes 98). - Do taller players get higher ratings? Calculate the correlation between
soccer_ratings
andsoccer_heights
to find out! - What is the average rating for attacking players (
'A'
)?
# Build cars DataFrame
names = ['United States', 'Australia', 'Japan', 'India', 'Russia', 'Morocco', 'Egypt']
dr = [True, False, False, False, True, True, True]
cpc = [809, 731, 588, 18, 200, 70, 45]
cars_dict = { 'country':names, 'drives_right':dr, 'cars_per_cap':cpc }
cars = pd.DataFrame(cars_dict)
print(cars)