naneos.frames
pandas DataFrame helpers for NaneosDeviceDataPoint lists.
Frames are indexed by unix_timestamp (ms) and keyed by serial number in the dict[int, pd.DataFrame] structures that flow from the managers to the upload.
add_data_points_to_dict(devices, points)
Append data points to the per-serial frames, one pandas round per device.
Source code in src/naneos/frames.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
add_to_existing_naneos_data(data, new_data)
Merge a second dict of frames into the first, concatenating per serial.
Source code in src/naneos/frames.py
138 139 140 141 142 143 144 145 146 147 148 | |
device_type_of(df, default=DeviceType.P2)
The device type recorded in a frame, or default when none is known.
Source code in src/naneos/frames.py
206 207 208 209 210 211 212 213 | |
sort_and_clean_naneos_data(data, serial_only=None)
Prepare gathered frames for the upload.
Per device: keep only the rows of the best connection type (serial over BLE link), sort by time, drop duplicate timestamps (last wins) and settle on one device type. Devices listed in serial_only are restricted to their serial rows even if none arrived.
Source code in src/naneos/frames.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
to_pandas_df(points)
Build a single DataFrame from many data points, indexed by unix_timestamp.
Points are converted in one batch: a DataFrame construction, an astype and a concat per point is the single most expensive thing this library does on a Raspberry Pi Zero 2 W.
Source code in src/naneos/frames.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |