GEP475GROUPINEEDANAP
InfiltrationHUB / Methods / Refreshers.assortedmethods / Infiltration_Appendix_forFutureStudents.ipynb
3752 viewsKernel: Python 3 (Anaconda)
On the manipulation of data from a CSV :
Appendix: Measuring Infiltration
- Starting with the Raw Netatmo data
The Netatmo data will be provided as an .csv file.
Create new Jupyter note-book and add the Netatmo file too the local directory.
Once the file is in the directory, you are ready to start using pandas.
- Reading in the file with pandas
In [291]:
In [306]:
Now the file is ready to be manipulated.
- The next two cells are some useful commands
In [307]:
Out[307]:
In [294]:
Out[294]:
From the .head function; we can see this file's index has the name : Timezone : America/Los_Angeles
it may be useful to have a shorter index name.
- How to change index names:
In [295]:
Out[295]:
If you want to, you can add units to the column names:
- Changing the title of columns
The syntax looks like this --> File.rename(columns = {'Oldname':'Newname'})
In [296]:
Out[296]:
- Isolating Columns of interest
In this case isolating Temperature
In [297]:
In [298]:
Out[298]:
Time
2016-02-19 13:26:00 18.8
2016-02-19 13:27:00 19.2
2016-02-19 13:27:00 19.9
2016-02-19 13:31:00 20.3
2016-02-19 13:36:00 21.2
Name: Temp_C, dtype: float64
-Creating new .csv file with only Temperature Data
In [299]:
Now we have a csv file of only the temperature data. This can prove helpful for repeated manipulation of the same data.
In [300]:
Out[300]:
-Adding columns
In [301]:
Out[301]:
- Adding a new column that is an mathematical opperation on another column
In [302]:
Out[302]:
- Deleting a column
In [303]:
Out[303]:
- Making a simple graphs using the 'magic' matlpotlib
In [304]:
Out[304]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f556070ee10>
In [305]:
Out[305]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f5560725b70>
In [0]:
In [0]:
In [0]:
In [0]:
In [0]: