In [89]:
import pandas as pd
import sys
import matplotlib
In [90]:
print('Python version ' + sys.version)
print('Pandas version ' + pd.__version__)
print('Matplotlib version ' + matplotlib.__version__)
In [91]:
names = ['Bob','Jessica','Mary','John','Mel']
births = [968, 155, 77, 578, 973]
In [92]:
zip(names, births)
Out[92]:
In [93]:
BabyDataSet = list (zip(names, births))
df = pd.DataFrame(data = BabyDataSet, columns=['Names', 'Births'])
In [94]:
df
Out[94]:
In [95]:
water23 = pd.read_csv("../data/waterlevel/Water23.csv", index_col='date')
In [96]:
water23
Out[96]:
In [97]:
ClimateWater = pd.read_csv("../data/waterlevel/ClimateWater.csv", index_col='date')
In [98]:
ClimateWater
Out[98]:
In [99]:
%pylab inline
In [100]:
#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[100]:
In [101]:
climate = pd.read_csv("../data/waterlevel/ClimateWater.csv", index_col='date')
In [102]:
#climate["WaterH1"].hist(bins=100)
water23['upperlevel'].hist(bins=500)
#water23['downlevel'].hist(bins=500)
Out[102]:
In [103]:
pd=climate["WaterH1"]
In [104]:
pd
Out[104]:
In [105]:
pd.iloc[5]
Out[105]:
In [106]:
climate["WaterH1"].plot(figsize=(20,5))
climate["Rainfall(mm)"].plot(figsize=(20,5))
Out[106]:
In [107]:
climate["WaterH1"].plot(figsize=(12,5))
Out[107]:
In [108]:
water23['upperlevel'].plot(figsize=(12,5))
water23['downlevel'].plot()
#climate["Rainfall(mm)"].plot.bar(figsize=(12,5))
Out[108]:
In [109]:
newindex = []
for ind in water23.index:
newindex.append(ind.split()[0])
In [110]:
vals, inds = np.unique(newindex, return_inverse=True)
In [111]:
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 [112]:
climate["WaterH1"].plot(figsize=(20,3))
grid(True)
In [113]:
water23['upperlevel'].plot(figsize=(20,3))
grid(True)
In [114]:
water23['downlevel'].plot(figsize=(20,3))
grid(True)
In [115]:
climate.keys()
Out[115]:
In [116]:
climate["Moisture(%)"].plot(figsize=(20,3))
Out[116]:
In [117]:
climate["SurfaceTemp(\xa1\xc6C)"].plot(figsize=(20,3))
grid(True)
In [ ]:
climate["Rainfall(mm)"].plot(figsize=(20,3))
grid(True)
In [ ]:
climate["Rainfall(mm)"].plot(figsize=(20,3)).bar
In [ ]:
In [ ]:
plt.plot(downh)
In [ ]:
waterdataset = list (zip(vals, upperh, downh))
#df = pd.DataFrame(data = waterdataset, columns=['vals', 'upperh', 'downh'])
In [ ]:
pd.DataFrame??
In [ ]:
df['upperH'].plot()
In [ ]: