A lot of times, we will use the Pi Zero just for data collection and transmission. We can use the power of Python to collect data on our Pi and save it to a CSV file for importing into spreadsheets or databases. Python has a CSV library for precisely this purpose, as a part of its vast collection of data manipulation tools.
If you are continuing with building your rpz_log_analysis.py
file, then you don't need to do anything more in preparation. If you'd like to see the code up to this point in the recipe, you can find it in the /ch4/
directory as rpz_log_analysis_csv.py
.
We're going to add another feature to our Raspberry Pi Zero log analysis program. This function will write out our log data into comma separated value, or CSV, format. This is a common format for data to be exported in for migration to other data systems, such as relational databases or spreadsheets. The only thing we change in the beginning...