Ejemplo n.º 1
0
import pandas as pd

# Load in the csv named "position_frequencies.csv" you made in exercise 24
# Save it as position_freq

____ = pd.____('data/____', ____)

# ____

# Use plot.bar() with position_freq
# Assign a color as Teal and set opacity to 0.5
# Don't forget to add a title as "Canuck Player Positions"

# ____ = ____.____.____(____ = ____,
#                      ____ = ____,
#                      ____ = ____)
Ejemplo n.º 2
0
## Data Looping Excercise 1
# Modify this program so that it prints the number of records in the file that has the fewest records.

import pandas
fewest = ____
for filename in glob.glob('data/*.csv'):
    dataframe = pandas.____(filename)
    fewest = min(____, dataframe.shape[0])
print('smallest file has', fewest, 'records')

## Data Looping Excercise 2

Write a program that reads in the regional data sets and plots the average GDP
per capita for each region over time in a single chart.

data_files_list = glob.___('')
mean_gdp = []
for file in data_file_list:
    df = pd.read_csv()
    mean_gdp.append()
    
mean_gdp_df = pd.DataFrame(data= , columns=)
Ejemplo n.º 3
0
import pandas as pd
import altair as alt
# Load in the csv named "canucks.csv" the same way you did earlier
# Save it as hockey_players

hockey_players = pd.____('data/____', ____)

# ____

# Use alt.Chart() to create a chart object
# Use the .mark_bar() to create a bar plot
# Use the .encode() to specify the column to plot
# Assign a color as Teal and set opacity to 0.5
# Don't forget to add a title as "Canuck Player Positions"

# position_bar = alt.Chart(
#    ____, width=500, height=300).____(
#        ____='____', ____=____).encode(
#            x='____',
#            y='____').properties(____='____')

#____
Ejemplo n.º 4
0
import pandas as pd
import altair as alt

# Load in the csv named "canucks.csv" the same way you did earlier
# Save it as hockey_players

hockey_players = pd.____('data/____', index_col=0)

# ____

# Use alt.Chart() to create a chart object
# Use the .mark_bar() to create a bar plot
# Use the .encode() to specify the column to plot
# Assign a color as Teal and set opacity to 0.5
# Don't forget to add a title as "Canuck Player Positions"

# position_bar = alt.Chart(
#    ____, width=500, height=300).____(
#        ____='____', ____=____).encode(
#            x='____',
#            y='____').properties(____='____')

#____