In [5]:
import pandas as pd
import sys
import matplotlib
In [6]:
print('Python version ' + sys.version)
print('Pandas version ' + pd.__version__)
print('Matplotlib version ' + matplotlib.__version__)
In [7]:
names = ['Bob','Jessica','Mary','John','Mel']
births = [968, 155, 77, 578, 973]
In [8]:
zip(names, births)
Out[8]:
In [9]:
BabyDataSet = list (zip(names, births))
df = pd.DataFrame(data = BabyDataSet, columns=['Names', 'Births'])
In [10]:
df
Out[10]:
In [11]:
water23 = pd.read_csv("../data/waterlevel/Water23.csv", index_col='date')
In [12]:
water23
Out[12]:
In [13]:
%pylab inline
In [14]:
#water23['upperlevel'].plot()
fig = plt.figure(figsize=(12,4))
ax1 = plt.subplot(111)
water23['downlevel'].plot(ax=ax1)
ax1_1 = ax1.twinx()
water23['upperlevel'].plot(ax=ax1_1)
#climate["Rainfall(mm)"].plot.bar(figsize=(12,5))
Out[14]:
In [15]:
climate = pd.read_csv("../data/waterlevel/ClimateWater.csv", index_col='date')
In [16]:
#climate["WaterH1"].hist(bins=100)
water23['upperlevel'].hist(bins=500)
#water23['downlevel'].hist(bins=500)
Out[16]:
In [17]:
pd=climate["WaterH1"]
In [18]:
pd
Out[18]:
In [19]:
pd.iloc[5]
Out[19]:
In [20]:
climate["WaterH1"].plot(figsize=(20,5))
climate["Rainfall(mm)"].plot(figsize=(20,5))
Out[20]:
In [18]:
climate["WaterH1"].plot(figsize=(12,5))
Out[18]:
In [19]:
water23['upperlevel'].plot(figsize=(12,5))
water23['downlevel'].plot()
#climate["Rainfall(mm)"].plot.bar(figsize=(12,5))
Out[19]:
In [20]:
newindex = []
for ind in water23.index:
newindex.append(ind.split()[0])
In [21]:
vals, inds = np.unique(newindex, return_inverse=True)
In [22]:
upperh = np.ones(vals.size)*np.nan
downh = np.ones(vals.size)*np.nan
for i in range (vals.size):
active = inds==i
upperh[i] = water23["upperlevel"].values[active].sum() / active.sum()
downh[i] = water23["downlevel"].values[active].sum() / active.sum()
In [ ]:
In [ ]:
In [23]:
climate["WaterH1"].plot(figsize=(20,3))
grid(True)
In [24]:
water23['upperlevel'].plot(figsize=(20,3))
grid(True)
In [25]:
water23['downlevel'].plot(figsize=(20,3))
grid(True)
In [26]:
climate.keys()
Out[26]:
In [27]:
climate["Moisture(%)"].plot(figsize=(20,3))
Out[27]:
In [28]:
climate["SurfaceTemp(\xa1\xc6C)"].plot(figsize=(20,3))
grid(True)
In [29]:
climate["Rainfall(mm)"].plot(figsize=(20,3))
grid(True)
In [30]:
climate["Rainfall(mm)"].plot(figsize=(20,3)).bar
Out[30]:
In [ ]:
In [31]:
plt.plot(downh)
Out[31]:
In [32]:
waterdataset = list (zip(vals, upperh, downh))
df = pd.DataFrame(data = waterdataset, columns=['date', 'upperH', 'downH'])
In [33]:
df
Out[33]:
In [33]:
df['upperH'].plot()
In [ ]: