sensortoolkit.reference._airnowtech_to_long.airnowtech_wide_to_long
- airnowtech_wide_to_long(path)[source]
Convert downloaded AirNowTech datasets from wide format to long format.
When users download datasets from the AirNowTech website, users may select various options for how the data are displayed under the ‘Display Settings’ menu. Next to the ‘Display’ section within the menu, the checkbox ‘Table’ should be selected by default. Next to the ‘Table’ checkbox is a dropdown menu with options for how the table will be displayed. Users can choose from ‘Unpivoted’, ‘Pivoted By Hour - Abbrev.’, ‘Pivoted By Hour - Full’, ‘Pivoted By Dataset’, or ‘Unpivoted’.
The sensortoolkit library works with timeseries data in unpivoted, long format. In turn, if users select one of the pivoted options in the display menu, this module should be used to convert pivoted (wide format) datasets to long format.
Note
The timezone is not indicated in pivoted datasets; however, nonpivoted versions of the same dataset downloaded from AirNowTech indicate the time stamp to be local standard time (LST) for matching measurement values in pivoted and non-pivoted datasets.
In turn, timestamps in datasets returned by this module should be considered to be logged in LST.
- Parameters
path (str) – Full path to the downloaded airnowtech dataset in pivoted (wide) format.
- Raises
ValueError – If the shape of the passed dataset does not correspond to an expected width (ncols = 28 for abbreviated wide datasets, ncols = 36 for full wide datasets). This likely occurs if an unpivoted (long format) AirNow-Tech dataset is passed to the function, which has a width of 16 columns.
- Returns
An unpivoted, long format version of the passed dataset. Should be passed to
sensortoolkit.reference.preprocess_airnowtech()
for- Return type
data (pandas DataFrame)