Created
May 14, 2020 14:18
-
-
Save cal687/371776454d15655233b4d91fc279b2d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#We will create wo histograms, each displaying the frequency of an occurrence each day of the year | |
#(either flights or flower blooms). | |
#You will use the in_bloom variable to find a count of the number of flowers that start blooming each day of the year. | |
#You will use the flights variable to find a count of the number of flights that occur each day of the year. | |
# import codecademylib3 | |
import codecademylib3 | |
import numpy as np | |
from matplotlib import pyplot as plt | |
# load in data | |
in_bloom = np.loadtxt(open("in-bloom.csv"), delimiter=",") | |
flights = np.loadtxt(open("flights.csv"), delimiter=",") | |
# Plot the histograms | |
plt.figure(1) | |
plt.subplot(211) | |
plt.hist(flights, range=(0,365), bins=365) | |
plt.xlabel('Days of the year') | |
plt.ylabel('Number of flights') | |
plt.title('Frequency of flights') | |
plt.subplot(212) | |
plt.hist(in_bloom, range=(0,365), bins=365) | |
plt.title("Flower Blooms and Flights by Day") | |
plt.ylabel("Bloom Count") | |
plt.xlabel("Day of the Year") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if someone said they wanted to visit Acadia while there weren’t many people there, but while flowers were blooming, when would you recommend? Based on these histograms, I would propose they go between days 250 and 300, which is the Fall. The flight’s histogram shows fewer flights between these days, while the flowers histogram indicates there should be a number of flowers in bloom during this time.