Created
November 1, 2018 11:53
-
-
Save debonx/8893050e5b35c041da561b0977f865a8 to your computer and use it in GitHub Desktop.
Using Numpy example. Records of weekly weather temperatures. More at www.numpy.org.
This file contains 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
import numpy as np | |
#Get data from CSV | |
#Temperatures recorded 4 times a day, at 0:00, 6:00, 12:00, and 18:00. Last weeks data (Monday through Friday) | |
temperatures = np.genfromtxt('temperature_data.csv', delimiter=',') | |
#Adjust temperatures | |
temperatures_fixed = temperatures + 3.0 | |
#Select Monday's Temperatures | |
monday_temperatures = temperatures_fixed[0,:] | |
#Select Thursday / Friday Temperatures | |
thursday_friday_morning = temperatures_fixed[3:,1] | |
#Select Extremes | |
temperature_extremes = temperatures_fixed[(temperatures_fixed < 50) | (temperatures_fixed > 60)] | |
#Print data | |
print(temperature_extremes) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment