Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

GEP475GROUPINEEDANAP

Views: 1461
Kernel: Python 3 (Anaconda)
import pandas as pd import numpy as np
PPM = pd.read_csv('Netatmo2016_2017CO2ppm.csv', parse_dates=True, index_col=1)
%matplotlib inline PPM['ppm'].plot()
<matplotlib.axes._subplots.AxesSubplot at 0x7f4384188e80>
Image in a Jupyter notebook
delta_CO2 = PPM['ppm'].diff(1)
PPM['Time'] = PPM.index delta_time = PPM['Time'].diff(1) / np.timedelta64(1,'m') slopes = delta_CO2 / delta_time
%matplotlib inline slopes.plot()
<matplotlib.axes._subplots.AxesSubplot at 0x7f438341b8d0>
Image in a Jupyter notebook
slopes.describe()
count 1.009790e+05 mean NaN std NaN min -inf 25% -1.200000e+00 50% 0.000000e+00 75% 1.000000e+00 max inf dtype: float64
slopes.head()
Time 2016-02-19 13:26:00 NaN 2016-02-19 13:27:00 NaN 2016-02-19 13:27:00 NaN 2016-02-19 13:31:00 NaN 2016-02-19 13:36:00 -1.0 dtype: float64
neg_slopes = slopes[slopes<0]
yearsdecay = (neg_slopes * PPM['ppm']) (yearsdecay).plot()
<matplotlib.axes._subplots.AxesSubplot at 0x7f4383715d30>
Image in a Jupyter notebook
(yearsdecay).head()
Time 2016-02-19 13:26:00 NaN 2016-02-19 13:27:00 NaN 2016-02-19 13:27:00 NaN 2016-02-19 13:31:00 NaN 2016-02-19 13:36:00 -332.0 dtype: float64

made Infiltration csv (perhaps for detailed reference later)

yearsdecay.to_csv('Infiltration_Rate.cvs')
column_names = ['Time', 'ppm/min'] In= pd.read_csv('Infiltration_Rate.cvs', parse_dates=True, index_col=0, names = column_names) In.head()
ppm/min
Time
2016-02-19 13:26:00 NaN
2016-02-19 13:27:00 NaN
2016-02-19 13:27:00 NaN
2016-02-19 13:31:00 NaN
2016-02-19 13:36:00 -332.0
In.describe()
ppm/min
count 4.885000e+04
mean -inf
std NaN
min -inf
25% -1.046850e+03
50% -5.160000e+02
75% -2.460000e+02
max -2.306667e+01
In = In.replace([np.inf, -np.inf], np.nan) In.describe()
ppm/min
count 48848.000000
mean -1141.663669
std 3186.375410
min -206960.600000
25% -1046.400000
50% -516.000000
75% -246.000000
max -23.066667
#In.plot()
In.hist(bins=1000)
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f4382e699e8>]], dtype=object)
Image in a Jupyter notebook
In.hist(bins=10000)
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f4382df5160>]], dtype=object)
Image in a Jupyter notebook
In.hist(bins=[-5000,-1000,-900,-850,-800,-750,-700,-650,-550,-500,-450,-400,-350,-300,-250,-200,0])
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f437f04c358>]], dtype=object)
Image in a Jupyter notebook

Question for Soto: how to make bins small enough to fit each value, or at least equal to the average difference

In.hist(bins=[-1000,-900,-800,-700,-600,-500,-400,-300,-200,-100,0])
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f43834fc828>]], dtype=object)
Image in a Jupyter notebook
In.hist(bins=[-700,-699,-698,-697,-696,-600,-550,-525,-500,-400,-300,-200,-100,0])
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f437de3b2b0>]], dtype=object)
Image in a Jupyter notebook

This needs some work

min_val = -4000 max_val = 0 num_bins = 1000 my_bins = np.linspace(min_val, max_val, num_bins) In.hist(bins=np.r_[-np.inf, my_bins, np.inf])
/ext/anaconda3/lib/python3.5/site-packages/matplotlib/axes/_axes.py:6277: RuntimeWarning: invalid value encountered in add patch = _barfunc(bins[:-1]+boffset, height, width, /ext/anaconda3/lib/python3.5/site-packages/matplotlib/axes/_axes.py:2105: RuntimeWarning: invalid value encountered in double_scalars left = [left[i] - width[i] / 2. for i in xrange(len(left))]
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f437d8a0b70>]], dtype=object)
Image in a Jupyter notebook
In.kdeplot()
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-23-a2f1855ae631> in <module>() ----> 1 In.kdeplot() /ext/anaconda3/lib/python3.5/site-packages/pandas/core/generic.py in __getattr__(self, name) 3079 if name in self._info_axis: 3080 return self[name] -> 3081 return object.__getattribute__(self, name) 3082 3083 def __setattr__(self, name, value): AttributeError: 'DataFrame' object has no attribute 'kdeplot'
In.plot.area(stacked=False);
In.plot(kind='kde', xlim=[0, 100000])