In [1]:
mean_temp = [ 0. , 0.4 , 1.1, 1.7 ,
2.4, 3.1 , 3.8 , 3.9,
5.2, 5.5, 6.0 , 5.9 ,
8.3 , 7.7, 8.3, 9.5 ,
9.5, 10.6, 11.5, 12.3 ,
13.2 , 11.9, 11.03, 10.1,
10. , 8.6, 9.1 , 7.2 ,
7.3, 6.5, 6.0, 5.9 ,
5.1, 3.6 , 3.3 , 3.5,
2.4, 1.5 , 1.1, 0.5]
max_temp = [ 18., 18., 19., 17., 17., 18., 17., 20., 17., 18., 18.,
18., 17., 16., 17., 18., 19., 19., 17., 19., 19., 16.,
17., 15., 17., 17., 18., 17., 20., 17., 16., 19., 15.,
15., 19., 17., 16., 17., 19., 16., 18., 19., 16., 19.,
18., 16., 19., 15., 16., 18., 14., 20., 17., 15., 17.,
16., 17., 19., 18., 18.]
In [ ]:
a = mean_temp[0]
N = len(max_temp)
b = max_temp[N-1]
# or
b = max_temp[-1]
vec = mean_temp[3:6]+max_temp[10:13]
In [ ]:
print(a, b, vec)
In [ ]:
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
In [ ]:
plt.plot(mean_temp)
plt.title('Mean of temperatures')
plt.xlabel('Days')
plt.ylabel('Temperature')
In [ ]:
def sawtooth(x):
return int(x)%2
In [ ]:
x = np.linspace(0,20,20)
y = np.array([sawtooth(xk) for xk in x])
plt.plot(x,y)
In [ ]:
ind = range(len(mean_temp))
width = 1
plt.bar(ind, mean_temp, width)
plt.show()
In [ ]:
bins = 10
plt.hist(mean_temp,bins,color='g')
plt.show()
In [2]:
from bokeh.io import output_notebook,show
output_notebook()
from bokeh.charts import Line
In [3]:
p = Line(mean_temp,
title = 'Temperature means',
xlabel = 'Days',
ylabel = 'Temperatures',
palette = ['blue']
)
show(p)
In [4]:
from bokeh.charts import Bar
p = Bar(mean_temp,
[str(i) for i in range(len(mean_temp))],
title = 'Temperature means'
)
show(p)
In [7]:
from bokeh.charts import Histogram
p = Histogram(max_temp,
bins = 4,
density = False,
palette = ['blue']
)
show(p)
In [ ]: