국민대, 파이썬, 데이터

W11

Table of Contenets

  1. NumPy Exercises
  2. Review - Random Walks
  3. Review - NumPy Basic
  4. NumPy Basic 2

In [3]:
from IPython.display import Image
import numpy as np

1. NumPy Exercises

1. np라는 이름으로 NumPy 패키지를 가져와보세요.


In [2]:
import numpy as np

2. 0인 원소 10개가 들어있는 ndarray를 만들어봅시다.


In [3]:
np.zeros(10)


Out[3]:
array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.])

3. 5부터 26까지 들어있는 ndarray를 만들어봅시다.


In [5]:
np.arange(5, 27)


Out[5]:
array([ 5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
       22, 23, 24, 25, 26])

3-1. 위에서 만든 배열을 역순으로 정렬시켜 보세요.


In [37]:
np.arange(5, 27)[::-1]


Out[37]:
array([26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10,
        9,  8,  7,  6,  5])

4. 랜덤값으로 3x3x3 array를 만들어봅시다.


In [6]:
np.random.random((3, 3, 3))


Out[6]:
array([[[ 0.00516614,  0.50602595,  0.84051308],
        [ 0.32199923,  0.31585021,  0.6228892 ],
        [ 0.02122064,  0.55353049,  0.00466646]],

       [[ 0.87396598,  0.66711519,  0.25994123],
        [ 0.96291755,  0.35368359,  0.63058615],
        [ 0.30328369,  0.23607763,  0.55820328]],

       [[ 0.25929785,  0.69830801,  0.72909632],
        [ 0.07476675,  0.33234072,  0.56910247],
        [ 0.81055475,  0.33902604,  0.6458722 ]]])

In [17]:
np.random.random((3, 3, 3))*10


Out[17]:
array([[[ 2.94748853,  6.49074358,  3.21219465],
        [ 5.63478353,  8.26468106,  2.04634029],
        [ 6.88887252,  3.01107568,  1.72974731]],

       [[ 3.75380868,  0.64237026,  7.40663812],
        [ 2.54868099,  8.83254998,  2.72443921],
        [ 1.53561916,  8.74802802,  3.06419221]],

       [[ 6.73107068,  5.74629228,  0.86259362],
        [ 6.56781371,  0.64029999,  6.13450733],
        [ 4.49760651,  3.23501903,  8.68558068]]])

In [18]:
np.around(np.random.random((3, 3, 3))*10)


Out[18]:
array([[[  4.,   8.,   2.],
        [  8.,   7.,   6.],
        [  1.,   9.,   9.]],

       [[  3.,   4.,  10.],
        [  2.,   9.,   4.],
        [ 10.,   4.,   1.]],

       [[  7.,   7.,   8.],
        [  1.,   4.,   3.],
        [  5.,   6.,   8.]]])

In [14]:
np.random.randint(1, 10, size=(3, 3, 3))


Out[14]:
array([[[5, 1, 5],
        [3, 8, 9],
        [4, 5, 5]],

       [[7, 4, 2],
        [3, 3, 7],
        [1, 8, 8]],

       [[6, 1, 9],
        [9, 6, 4],
        [6, 5, 3]]])

5. 8X8 사이즈의 체커보드를 만들어봅시다.


In [25]:
Image(url='http://www.nctm.org/uploadedImages/Publications/TCM_Blog/checkerboard.png')


Out[25]:

In [16]:
chkboard = np.zeros((8, 8), dtype=int)
print(chkboard)


[[0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0]]

In [19]:
chkboard[1::2, ::2] = 1
chkboard[::2, 1::2] = 1
chkboard


Out[19]:
array([[0, 1, 0, 1, 0, 1, 0, 1],
       [1, 0, 1, 0, 1, 0, 1, 0],
       [0, 1, 0, 1, 0, 1, 0, 1],
       [1, 0, 1, 0, 1, 0, 1, 0],
       [0, 1, 0, 1, 0, 1, 0, 1],
       [1, 0, 1, 0, 1, 0, 1, 0],
       [0, 1, 0, 1, 0, 1, 0, 1],
       [1, 0, 1, 0, 1, 0, 1, 0]])

2. Review - Random Walks


In [ ]:
def rwalks(steps=1000):
    position = 0
    walk = [position]
    max_steps = int(steps)
    arr = np.random.randint(0, 2, size=max_steps)
    steps = np.where(arr == 0, -1, 1)
    walk = np.cumsum(steps)
    
    return walk

In [32]:
# Random Integer
a = np.random.randint(0, 2, size=100)
a


Out[32]:
array([1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0,
       1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0,
       0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1,
       1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0,
       0, 0, 1, 1, 1, 0, 1, 0])

In [33]:
# Where 조건(Filter)
b = np.where(a == 0, -1, 1)
b


Out[33]:
array([ 1,  1,  1,  1, -1, -1,  1, -1, -1,  1, -1,  1,  1,  1,  1, -1,  1,
       -1, -1, -1,  1, -1, -1,  1,  1,  1,  1, -1, -1, -1,  1,  1, -1, -1,
        1,  1,  1, -1,  1, -1,  1,  1,  1, -1, -1, -1, -1,  1,  1, -1,  1,
       -1,  1,  1,  1,  1, -1, -1,  1, -1,  1,  1, -1, -1,  1,  1,  1, -1,
        1,  1,  1, -1, -1, -1, -1, -1, -1,  1, -1, -1,  1, -1,  1,  1,  1,
       -1,  1,  1, -1,  1, -1, -1, -1, -1,  1,  1,  1, -1,  1, -1])

In [34]:
# Cumulative Sum
c = np.cumsum(b)
c


Out[34]:
array([ 1,  2,  3,  4,  3,  2,  3,  2,  1,  2,  1,  2,  3,  4,  5,  4,  5,
        4,  3,  2,  3,  2,  1,  2,  3,  4,  5,  4,  3,  2,  3,  4,  3,  2,
        3,  4,  5,  4,  5,  4,  5,  6,  7,  6,  5,  4,  3,  4,  5,  4,  5,
        4,  5,  6,  7,  8,  7,  6,  7,  6,  7,  8,  7,  6,  7,  8,  9,  8,
        9, 10, 11, 10,  9,  8,  7,  6,  5,  6,  5,  4,  5,  4,  5,  6,  7,
        6,  7,  8,  7,  8,  7,  6,  5,  4,  5,  6,  7,  6,  7,  6])

In [35]:
# Plotting (그래프로 표현하기) Using matplotlib.pyplot
plt.plot(c)


Out[35]:
[<matplotlib.lines.Line2D at 0x111198ac8>]

3. Review - NumPy Basic

1. Creation


In [40]:
np.array([1, 2, 3])


Out[40]:
array([1, 2, 3])

In [41]:
np.arange(10)


Out[41]:
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

In [43]:
np.linspace(1, 10, 5)


Out[43]:
array([  1.  ,   3.25,   5.5 ,   7.75,  10.  ])

In [45]:
np.ones([3, 3])


Out[45]:
array([[ 1.,  1.,  1.],
       [ 1.,  1.,  1.],
       [ 1.,  1.,  1.]])

In [46]:
np.zeros([2, 3])


Out[46]:
array([[ 0.,  0.,  0.],
       [ 0.,  0.,  0.]])

In [48]:
np.eye(6)


Out[48]:
array([[ 1.,  0.,  0.,  0.,  0.,  0.],
       [ 0.,  1.,  0.,  0.,  0.,  0.],
       [ 0.,  0.,  1.,  0.,  0.,  0.],
       [ 0.,  0.,  0.,  1.,  0.,  0.],
       [ 0.,  0.,  0.,  0.,  1.,  0.],
       [ 0.,  0.,  0.,  0.,  0.,  1.]])

In [49]:
np.diag([1, 2, 3])


Out[49]:
array([[1, 0, 0],
       [0, 2, 0],
       [0, 0, 3]])

In [54]:
np.random.random([2, 3])


Out[54]:
array([[ 0.71016406,  0.9855232 ,  0.03858944],
       [ 0.25381331,  0.51368246,  0.57572851]])

In [57]:
np.random.random([2, 3, 4])


Out[57]:
array([[[ 0.59187243,  0.27501516,  0.50965145,  0.93219133],
        [ 0.68674768,  0.52115107,  0.48961321,  0.71876235],
        [ 0.80774999,  0.88500609,  0.29210594,  0.48559511]],

       [[ 0.90390125,  0.53587705,  0.45644626,  0.15963893],
        [ 0.06073268,  0.30631861,  0.26969234,  0.31827919],
        [ 0.69284183,  0.16321423,  0.39365652,  0.19328849]]])

2. Index and Slice


In [25]:
a = np.random.randint(1, 10, size=(5, 5))
a


Out[25]:
array([[7, 5, 8, 6, 6],
       [9, 3, 1, 2, 2],
       [9, 9, 9, 7, 6],
       [7, 6, 5, 4, 2],
       [2, 6, 3, 3, 7]])

In [28]:
a[2, 4]


Out[28]:
6

In [29]:
a[1:3]


Out[29]:
array([[9, 3, 1, 2, 2],
       [9, 9, 9, 7, 6]])

4. NumPy Basic 2

0. Review

  • Creation, Index, Slice, Random, Where, Cumsum, Min, Max

1. Manipulating

1) reshape(), shape


In [93]:
a = np.arange(24)
a


Out[93]:
array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
       17, 18, 19, 20, 21, 22, 23])

In [37]:
a.reshape(6, 4)


Out[37]:
array([[ 0,  1,  2,  3],
       [ 4,  5,  6,  7],
       [ 8,  9, 10, 11],
       [12, 13, 14, 15],
       [16, 17, 18, 19],
       [20, 21, 22, 23]])

In [38]:
a


Out[38]:
array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
       17, 18, 19, 20, 21, 22, 23])

In [33]:
a.reshape(2, )


Out[33]:
array([[ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11],
       [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]])

In [34]:
a.reshape(2, -1)


Out[34]:
array([[ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11],
       [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]])

In [35]:
a.reshape(2, 3, 4)


Out[35]:
array([[[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]],

       [[12, 13, 14, 15],
        [16, 17, 18, 19],
        [20, 21, 22, 23]]])

In [92]:
a


Out[92]:
array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
       17, 18, 19, 20, 21, 22, 23])

reshape 함수는 reshaping된 값을 반환해줄 뿐이지 객체를 바꿔주지는 않습니다.


In [39]:
a.shape = (2, 3, 4)

In [40]:
a


Out[40]:
array([[[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]],

       [[12, 13, 14, 15],
        [16, 17, 18, 19],
        [20, 21, 22, 23]]])

shape 속성은 객체를 바꿔줍니다.

2) transpose(), T


In [94]:
a.shape = (4, 6)
a


Out[94]:
array([[ 0,  1,  2,  3,  4,  5],
       [ 6,  7,  8,  9, 10, 11],
       [12, 13, 14, 15, 16, 17],
       [18, 19, 20, 21, 22, 23]])

In [74]:
a


Out[74]:
array([[ 0,  1,  2,  3,  4,  5],
       [ 6,  7,  8,  9, 10, 11],
       [12, 13, 14, 15, 16, 17],
       [18, 19, 20, 21, 22, 23]])

In [84]:
a.transpose()


Out[84]:
array([[ 0,  6, 12, 18],
       [ 1,  7, 13, 19],
       [ 2,  8, 14, 20],
       [ 3,  9, 15, 21],
       [ 4, 10, 16, 22],
       [ 5, 11, 17, 23]])

In [85]:
a


Out[85]:
array([[ 0,  1,  2,  3,  4,  5],
       [ 6,  7,  8,  9, 10, 11],
       [12, 13, 14, 15, 16, 17],
       [18, 19, 20, 21, 22, 23]])

In [95]:
b = a.transpose()

In [96]:
b


Out[96]:
array([[ 0,  6, 12, 18],
       [ 1,  7, 13, 19],
       [ 2,  8, 14, 20],
       [ 3,  9, 15, 21],
       [ 4, 10, 16, 22],
       [ 5, 11, 17, 23]])

In [89]:
a = b.shape

In [92]:
a


Out[92]:
(6, 4)

In [98]:
a


Out[98]:
array([[ 0,  1,  2,  3,  4,  5],
       [ 6,  7,  8,  9, 10, 11],
       [12, 13, 14, 15, 16, 17],
       [18, 19, 20, 21, 22, 23]])

In [99]:
b


Out[99]:
array([[ 0,  6, 12, 18],
       [ 1,  7, 13, 19],
       [ 2,  8, 14, 20],
       [ 3,  9, 15, 21],
       [ 4, 10, 16, 22],
       [ 5, 11, 17, 23]])

In [100]:
b.reshape(4, 6)


Out[100]:
array([[ 0,  6, 12, 18,  1,  7],
       [13, 19,  2,  8, 14, 20],
       [ 3,  9, 15, 21,  4, 10],
       [16, 22,  5, 11, 17, 23]])

In [ ]:
a.shape = a

In [46]:
a


Out[46]:
array([[ 0,  1,  2,  3,  4,  5],
       [ 6,  7,  8,  9, 10, 11],
       [12, 13, 14, 15, 16, 17],
       [18, 19, 20, 21, 22, 23]])

In [47]:
a.T


Out[47]:
array([[ 0,  6, 12, 18],
       [ 1,  7, 13, 19],
       [ 2,  8, 14, 20],
       [ 3,  9, 15, 21],
       [ 4, 10, 16, 22],
       [ 5, 11, 17, 23]])

In [49]:
a


Out[49]:
array([[ 0,  1,  2,  3,  4,  5],
       [ 6,  7,  8,  9, 10, 11],
       [12, 13, 14, 15, 16, 17],
       [18, 19, 20, 21, 22, 23]])

3) ravel()


In [52]:
a.ravel()


Out[52]:
array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
       17, 18, 19, 20, 21, 22, 23])

In [53]:
a


Out[53]:
array([[ 0,  1,  2,  3,  4,  5],
       [ 6,  7,  8,  9, 10, 11],
       [12, 13, 14, 15, 16, 17],
       [18, 19, 20, 21, 22, 23]])

2. Operations

1) Basic Operations


In [56]:
a = np.array([20,30,40,50])
b = np.arange(4)

In [55]:
a


Out[55]:
array([20, 30, 40, 50])

In [57]:
b


Out[57]:
array([0, 1, 2, 3])

In [138]:
a - b


Out[138]:
array([20, 29, 38, 47])

In [140]:
b**2


Out[140]:
array([0, 1, 4, 9])

In [143]:
10 * a


Out[143]:
array([200, 300, 400, 500])

In [145]:
a < 35


Out[145]:
array([ True,  True, False, False], dtype=bool)

In [58]:
a = np.array([[1, 1], [0, 1]])
b = np.array([[2, 0], [3, 4]])

In [59]:
a


Out[59]:
array([[1, 1],
       [0, 1]])

In [60]:
b


Out[60]:
array([[2, 0],
       [3, 4]])

In [154]:
# elementwise product
a*b


Out[154]:
array([[2, 0],
       [0, 4]])

In [155]:
# matrix product
np.dot(a, b)


Out[155]:
array([[5, 4],
       [3, 4]])

In [156]:
np.matrix([[1, 1], [0, 1]]) * np.matrix([[2, 0], [3, 4]])


Out[156]:
matrix([[5, 4],
        [3, 4]])

In [159]:
b.sum()


Out[159]:
9

In [160]:
b.min()


Out[160]:
0

In [161]:
b.max()


Out[161]:
4

2) Universal Functions


In [165]:
a = np.arange(10)
a


Out[165]:
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

In [166]:
np.sqrt(a)


Out[166]:
array([ 0.        ,  1.        ,  1.41421356,  1.73205081,  2.        ,
        2.23606798,  2.44948974,  2.64575131,  2.82842712,  3.        ])

In [167]:
np.exp(a)


Out[167]:
array([  1.00000000e+00,   2.71828183e+00,   7.38905610e+00,
         2.00855369e+01,   5.45981500e+01,   1.48413159e+02,
         4.03428793e+02,   1.09663316e+03,   2.98095799e+03,
         8.10308393e+03])

5. Data Analysis Example with Numpy


In [270]:
from numpy import genfromtxt
import datetime
import matplotlib.pyplot as plt
%matplotlib inline

In [61]:
data = np.genfromtxt('./data/2015_weather.csv', delimiter=',', dtype='object', names=True)

In [62]:
data


Out[62]:
array([ (b'20150101', b'701', b'37.5457649', b'126.9169618', b'-6', b'-7', b'-7', b'-8', b'-8', b'-8', b'-8', b'-8', b'-9', b'-8', b'-8', b'-7', b'-5', b'-5', b'-4', b'-5', b'-5', b'-6', b'-6', b'-6', b'-7', b'-7', b'-7', b'-7', b'-4', b'-9', b'-7', b'2015-Jan-02 11:45:24 PM'),
       (b'20150101', b'703', b'37.4934152', b'127.095083', b'-6', b'-7', b'-7', b'-8', b'-8', b'-8', b'-9', b'-9', b'-9', b'-8', b'-7', b'-6', b'-6', b'-5', b'-5', b'-5', b'-5', b'-6', b'-6', b'-7', b'-7', b'-8', b'-7', b'-8', b'-5', b'-9', b'-7', b'2015-Jan-02 11:45:24 PM'),
       (b'20150101', b'704', b'37.4898974', b'127.0947259', b'-6', b'-7', b'-7', b'-8', b'-8', b'-8', b'-9', b'-9', b'-9', b'-8', b'-7', b'-6', b'-6', b'-5', b'-5', b'-5', b'-5', b'-6', b'-6', b'-7', b'-7', b'-8', b'-7', b'-8', b'-5', b'-9', b'-7', b'2015-Jan-02 11:45:24 PM'),
       ...,
       (b'20150908', b'727', b'35.207637', b'128.7977762', b'17', b'17', b'17', b'17', b'17', b'17', b'17', b'19', b'22', b'24', b'24', b'23', b'24', b'24', b'24', b'24', b'23', b'22', b'21', b'21', b'20', b'19', b'19', b'18', b'24', b'17', b'20', b'2015-Sep-09 11:45:11 PM'),
       (b'20150908', b'728', b'35.3253504', b'129.0232303', b'18', b'18', b'18', b'19', b'18', b'18', b'19', b'20', b'21', b'22', b'24', b'24', b'24', b'25', b'25', b'25', b'25', b'23', b'22', b'21', b'21', b'20', b'20', b'20', b'25', b'18', b'21', b'2015-Sep-09 11:45:11 PM'),
       (b'20150908', b'729', b'36.6044407', b'127.4434087', b'16', b'15', b'14', b'13', b'12', b'12', b'13', b'17', b'20', b'22', b'23', b'24', b'26', b'27', b'27', b'27', b'26', b'25', b'22', b'19', b'18', b'17', b'16', b'14', b'27', b'12', b'19', b'2015-Sep-09 11:45:11 PM')], 
      dtype=[('ISSUE_DATE', 'O'), ('PLANT_ID', 'O'), ('LATITUDE', 'O'), ('LONGITUDE', 'O'), ('WTHR_01H', 'O'), ('WTHR_02H', 'O'), ('WTHR_03H', 'O'), ('WTHR_04H', 'O'), ('WTHR_05H', 'O'), ('WTHR_06H', 'O'), ('WTHR_07H', 'O'), ('WTHR_08H', 'O'), ('WTHR_09H', 'O'), ('WTHR_10H', 'O'), ('WTHR_11H', 'O'), ('WTHR_12H', 'O'), ('WTHR_13H', 'O'), ('WTHR_14H', 'O'), ('WTHR_15H', 'O'), ('WTHR_16H', 'O'), ('WTHR_17H', 'O'), ('WTHR_18H', 'O'), ('WTHR_19H', 'O'), ('WTHR_20H', 'O'), ('WTHR_21H', 'O'), ('WTHR_22H', 'O'), ('WTHR_23H', 'O'), ('WTHR_24H', 'O'), ('WTHR_MAX', 'O'), ('WTHR_MIN', 'O'), ('WTHR_AVG', 'O'), ('MODIFY_DATE', 'O')])

In [65]:
data[0][0]


Out[65]:
b'20150101'

In [406]:
data['WTHR_MAX']


Out[406]:
array([b'-4', b'-5', b'-5', ..., b'24', b'25', b'27'], dtype=object)

In [66]:
max_lst = np.where(data['LATITUDE'] == b'37.5457649', data['WTHR_MAX'], False)
max_lst


Out[66]:
array([b'-4', False, False, ..., False, False, False], dtype=object)

In [68]:
WTHR_MAX = []

In [69]:
for i in range(len(max_lst)):
    if max_lst[i] != False:
        WTHR_MAX.append(max_lst[i])

In [70]:
WTHR_MAX


Out[70]:
[b'-4',
 b'-2',
 b'4',
 b'8',
 b'9',
 b'4',
 b'-1',
 b'0',
 b'4',
 b'6',
 b'3',
 b'4',
 b'7',
 b'5',
 b'9',
 b'4',
 b'0',
 b'3',
 b'4',
 b'4',
 b'7',
 b'8',
 b'5',
 b'8',
 b'6',
 b'7',
 b'2',
 b'2',
 b'3',
 b'1',
 b'0',
 b'3',
 b'6',
 b'7',
 b'5',
 b'4',
 b'7',
 b'6',
 b'-4',
 b'1',
 b'6',
 b'7',
 b'1',
 b'3',
 b'7',
 b'13',
 b'9',
 b'4',
 b'4',
 b'9',
 b'11',
 b'8',
 b'8',
 b'5',
 b'6',
 b'12',
 b'5',
 b'3',
 b'7',
 b'5',
 b'9',
 b'7',
 b'1',
 b'5',
 b'9',
 b'10',
 b'16',
 b'9',
 b'1',
 b'7',
 b'6',
 b'11',
 b'11',
 b'11',
 b'19',
 b'17',
 b'15',
 b'21',
 b'21',
 b'17',
 b'14',
 b'10',
 b'11',
 b'14',
 b'15',
 b'15',
 b'17',
 b'16',
 b'20',
 b'15',
 b'19',
 b'21',
 b'15',
 b'19',
 b'13',
 b'14',
 b'12',
 b'13',
 b'15',
 b'18',
 b'20',
 b'20',
 b'18',
 b'9',
 b'17',
 b'15',
 b'15',
 b'23',
 b'18',
 b'17',
 b'20',
 b'20',
 b'20',
 b'22',
 b'22',
 b'23',
 b'24',
 b'26',
 b'19',
 b'28',
 b'26',
 b'25',
 b'20',
 b'19',
 b'19',
 b'21',
 b'23',
 b'22',
 b'23',
 b'25',
 b'24',
 b'17',
 b'20',
 b'25',
 b'24',
 b'24',
 b'25',
 b'21',
 b'17',
 b'22',
 b'24',
 b'26',
 b'27',
 b'26',
 b'27',
 b'28',
 b'30',
 b'30',
 b'28',
 b'23',
 b'28',
 b'27',
 b'28',
 b'28',
 b'29',
 b'23',
 b'27',
 b'30',
 b'26',
 b'26',
 b'33',
 b'29',
 b'28',
 b'29',
 b'26',
 b'29',
 b'29',
 b'28',
 b'30',
 b'29',
 b'23',
 b'29',
 b'28',
 b'30',
 b'29',
 b'28',
 b'25',
 b'30',
 b'30',
 b'29',
 b'29',
 b'27',
 b'28',
 b'26',
 b'29',
 b'28',
 b'32',
 b'29',
 b'26',
 b'31',
 b'33',
 b'35',
 b'27',
 b'25',
 b'29',
 b'34',
 b'29',
 b'30',
 b'27',
 b'29',
 b'30',
 b'29',
 b'32',
 b'31',
 b'25',
 b'27',
 b'29',
 b'29',
 b'30',
 b'29',
 b'32',
 b'31',
 b'31',
 b'29',
 b'31',
 b'30',
 b'32',
 b'33',
 b'34',
 b'33',
 b'31',
 b'31',
 b'30',
 b'33',
 b'31',
 b'31',
 b'30',
 b'31',
 b'32',
 b'33',
 b'31',
 b'28',
 b'29',
 b'29',
 b'32',
 b'31',
 b'26',
 b'24',
 b'29',
 b'28',
 b'30',
 b'29',
 b'32',
 b'31',
 b'28',
 b'28',
 b'30',
 b'25',
 b'26',
 b'28',
 b'29']

In [399]:
plt.plot(WTHR_MAX)


Out[399]:
[<matplotlib.lines.Line2D at 0x11169e048>]