Repair datasets with common bugs#
Export routines from battery test equipment can sometimes insert bugs like non-monotonic times. We have included some functions to recognize these occurences during validation along with some basic tools to repair them.
import bdf
from bdf.repair import fix_time
# Read the raw source data and display the header
df, meta = bdf.read("https://zenodo.org/records/17295469/files/SINTEF__SLPBA842124HV__2024-10-23__Rate_25degC__Neware__Time_Bug.csv")
df = df.to_pandas()
/home/runner/work/battery-data-format/battery-data-format/src/bdf/table_parsers.py:195: UserWarning: tz defaulted to UTC; pass tz=... if data was recorded in a different timezone
result = self.normalizer.normalize(
bdf.plot(df)
<Figure size 640x480 with 1 Axes>
# Fix non-monotonic time
df = fix_time(df, method="auto")
# Visualize the repaired dataset
bdf.plot(df)
<Figure size 640x480 with 1 Axes>