Question: Understand lesson 1 . py completely. Modify the lecture code as follows. Plot the largest snowfall by year. Make Bridger Bowl the title of the

Understand lesson1.py completely.
Modify the lecture code as follows.
Plot the largest snowfall by year.
Make Bridger Bowl the title of the chart.
The lecture code draws a bar chart. Draw at least two other types of graphs with the data.
import pandas as pd
import matplotlib.pyplot as plt
import sys # to determine Python version number
import matplotlib # to determine Matplotlib version number
print('Python version '+ sys.version)
print('Pandas version '+ pd.__version__)
print('Matplotlib version '+ matplotlib.__version__)
print()
# Create Data --------------------------
#
years =["12-13","13-14","14-15","15-16","16-17","17-18",\
"18-19","19-20","20-21","21-22","22-23"] # bridger bowl season
total_snowfall =[254,316,166,228,209,271,177,186,192,107,193] # inches
largest_snowfall =[25,20,14,14,21,20,15,21,22,8,18] # inches
BridgerDataSet = list(zip(years, total_snowfall, largest_snowfall))
print("BridgerDataSet:", BridgerDataSet, "
")
data = pd.DataFrame(data = BridgerDataSet, columns=["Season", "Total", "Largest"])
print("Bridger DataFrame")
print("-----------------")
print(data)
data.to_csv('bridger.csv',index=False,header=False)
# Get Data -----------------------------
bridger = pd.read_csv('bridger.csv', names=['Season', 'Total', 'Largest'])
print("
Bridger DataFrame after reading csv file")
print("----------------------------------------")
print(bridger)
# Prepare Data -------------------------
if (bridger.Total.dtype == 'int64'):
print("
Total snowfall is of type int64")
else:
print("
Total Snowfall is of type", bridger.Total.dtype)
# Analyze Data -------------------------
sorted_data = bridger.sort_values(['Total'], ascending=False)
print("
Sorted Bridger Data Set")
print("-----------------------")
print(sorted_data)
print("
The least total snowfall was", bridger['Total'].min())
# Display Data -------------------------
bridger.plot(x="Season", y="Total", kind="bar", color="yellow", \
xlabel="Season", ylabel="Total Snowfall")
plt.show()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!