The Data Wrangler VSCode extension column summaries can show a histogram of the distribution of data in a column, but this summary is not particularly useful for time series data like sensor signals.
- If not installed, install the Data Wrangler VSCode extension
- If
sparklinesis not installed in the environment to be used by Data Wrangler, use e.g.uvto add thesparklinespackage to the project's dev dependency group
uv add --dev sparklines- Open a data file, e.g. a CSV in VSCode and click the "Open in Data Wrangler" button in the tab ribbon
- If prompted to select a runtime/kernel to run Data Wrangler with, select the one that you installed
sparklinesto, probably the.venvin the current directory - Paste the following Python code into the active Data Wrangler view of e.g. a CSV data file containing time series data in the columns. This inserts a row at the top of the dataframe with a little ASCII "plot" of chronological bars, where no bar indicates the minimum value and a full bar indicates the maximum. Note that this step should be applied only temporarily to preview data as it inserts the ASCII strings into the actual columns of numerical data, but is useful to preview time series data nonetheless.
from pandas import Series, concat, read_csv
from sparklines import sparklines
WIDTH = 20
df = df.apply(
lambda ser: concat([
Series(
[
"\n".join(
sparklines(
numbers=ser[:: len(ser) // WIDTH].dropna() - ser[:: len(ser) // WIDTH].min(),
num_lines=1,
)
)
]
),
ser,
])
)
