CSV format
Comma-separated value (CSV) files are the most popular formats for storing tabular data generated by IoT systems. In a .csvÂ
file, the values of the records are stored in plain-text rows, with each row containing the values of the fields separated by a separator. The separator is a comma by default but can be configured to be any other character. In this section, we will learn how to use data from CSV files with Python's csv
, numpy
, and pandas
modules. We will use the household_power_consumption
data file. The file can be downloaded from the following GitHub link: https://github.com/ahanse/machlearning/blob/master/household_power_consumption.csv. To access the data files, we define the following variables:
data_folder = '../../data/household_power_consumption' data_file = 'household_power_consumption.csv'
Generally, to quickly read the data from CSV files, use the Python csv
module; however, if the data needs to be interpreted as a mix of date, and numeric data fields, it's better...