Created
January 22, 2020 05:24
-
-
Save garethpaul/2c4286334e4f5e6a53414a9ddcb95136 to your computer and use it in GitHub Desktop.
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
#initialize dataframe | |
df_temp = pd.DataFrame() | |
#populate date and average temperature fields (cast string date to datetime and convert temperature from tenths of Celsius to Fahrenheit) | |
df_temp['date'] = [datetime.strptime(d, "%Y-%m-%dT%H:%M:%S") for d in dates_temp] | |
df_temp['avgTemp'] = [float(v)/10.0*1.8 + 32 for v in temps] | |
df_temp['minTemp'] = [float(v)/10.0*1.8 + 32 for v in minT] | |
df_temp['maxTemp'] = [float(v)/10.0*1.8 + 32 for v in maxT] | |
# Convert mm/day to inch/day | |
df_temp['prcp'] = [float(v)/25.54 for v in prcp] | |
df_temp.head() | |
df_temp.plot(kind='line',x='date',y='avgTemp') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment