{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "# Repair datasets with common bugs\n", "\n", "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. " ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": {}, "outputs": [], "source": [ "import bdf\n", "from bdf.repair import fix_time" ] }, { "cell_type": "code", "execution_count": null, "id": "2", "metadata": {}, "outputs": [], "source": [ "# Read the raw source data and display the header\n", "df, meta = bdf.read(\"https://zenodo.org/records/17295469/files/SINTEF__SLPBA842124HV__2024-10-23__Rate_25degC__Neware__Time_Bug.csv\")\n", "df = df.to_pandas()" ] }, { "cell_type": "code", "execution_count": null, "id": "3", "metadata": {}, "outputs": [], "source": [ "bdf.plot(df)" ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": {}, "outputs": [], "source": [ "# Fix non-monotonic time\n", "df = fix_time(df, method=\"auto\")" ] }, { "cell_type": "code", "execution_count": null, "id": "5", "metadata": {}, "outputs": [], "source": [ "# Visualize the repaired dataset\n", "bdf.plot(df)" ] } ], "metadata": { "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.10" } }, "nbformat": 4, "nbformat_minor": 5 }