Skip to main content

showstats: quick and compact summary statistics

showstats quickly produces compact summary statistic tables with vertical orientation.

import duckdb
import pandas as pd
import polars as pl

from showstats import show_stats, table_one
# Daily weather in Seattle, 2012-2015
weather_path = "docs/data/seattle-weather.csv"
df = pl.read_csv(weather_path, try_parse_dates=True)

show_stats(df)
-Date and datetime columns (N=1461)---------------------------------------------
 Col   NA%  Median      Min         Max        
 date  0    2013-12-31  2012-01-01  2015-12-31 
-Numerical columns (N=1461)-----------------------------------------------------
 Col            NA%  Avg    Median  SD    Min   Max  
 precipitation  0    3.03   0.0     6.68  0.0   55.9 
 temp_max       0    16.44  15.6    7.35  -1.6  35.6 
 temp_min       0    8.23   8.3     5.02  -7.1  18.3 
 wind           0    3.24   3.0     1.44  0.4   9.5  
-Categorical columns (N=1461)---------------------------------------------------
 Col      NA%  Uniques  Top 1       Top 2      Top 3    
 weather  0    5        rain (44%)  sun (44%)  fog (7%) 
# Select a table type, columns, or extra quantiles.
show_stats(df, "cat")  # Other options are num and time.
show_stats(df.select("temp_max", "wind"), "num", quantiles=[0.1, 0.9])

Use table_one for a numerical and categorical Table 1 summary. The style can be mean_sd, median_mad, or median_iqr. Use group to report the statistics for each value of another variable.

table_one_df = pl.DataFrame(
    {
        "age": [34.0, 45.0, None, 52.0],
        "score": [7.5, 8.0, 9.5, 7.0],
        "outcome": ["yes", "no", "yes", "yes"],
        "arm": ["control", "control", "treated", "treated"],
    }
)

table_one(table_one_df, style="mean_sd", group="arm")
-Table 1 (N=4)------------------------------------------------------------------
 Col                NA%  Overall       arm = control (N=2)  arm = treated (N=2) 
 age (mean (SD))    25   43.67 (9.07)  39.5 (7.78)          52.0                
 score (mean (SD))  0    8.0 (1.08)    7.75 (0.35)          8.25 (1.77)         
 outcome = yes (%)  0    3 (75%)       1 (50%)              2 (100%)            
 outcome = no (%)        1 (25%)       1 (50%)              0 (0%)              

The NA% column gives the percentage of missing values. Set show_missing=False to omit it. Use n_categories to change the number of categorical values shown.

# Polars detects dates. pandas needs the date column name.
pandas_df = pd.read_csv(weather_path, parse_dates=["date"])
show_stats(pandas_df[["date", "temp_max", "wind"]])

# DuckDB relations are lazy.
duckdb_df = duckdb.read_csv(weather_path).select("date, temp_max, wind")
show_stats(duckdb_df)

Command line

Install with uv tool install "showstats[cli]" for CSV and Parquet support. The extra supplies PyArrow; plain showstats also works if a suitable dataframe library is already installed in the same environment. In a project, use uv add "showstats[cli]" and run commands with uv run showstats.

showstats file.csv                 # Summary of all columns
showstats file.parquet --type num  # Numerical summary only
showstats file.csv --type cat      # Categorical summary only
showstats file.csv -h              # First 3 rows
showstats file.csv -t              # Last 3 rows
showstats file.csv -h 10           # First 10 rows
showstats file.csv --offset 4      # Rows 4, 5, and 6

Row numbers start at 0. Negative offsets count from the end, and -h N sets the preview length. Previews default to --layout auto: a normal table when it fits the terminal, or one record per block otherwise. Use --layout table or --layout expanded to choose explicitly.

Files are read into memory. Use showstats --help for all options; -h means head.

Optional Great Tables output

Install the optional package with uv add "showstats[gt]". Set fmt="gt" in show_stats or table_one to return a Great Tables object. Set color_missing=True to add a white to dark gray background scale.

table = show_stats(df, "num", fmt="gt")
table

Great Tables output

  • showstats works with data frames supported by narwhals, including polars, pandas, and lazy DuckDB relations.

  • Inspired by the R packages skimr and modelsummary.

  • Numbers with many digits are automatically converted to scientific notation.

  • The example above uses Seattle daily weather from vega-datasets (BSD-3-Clause).

  • Fast: under a second to summarise a 1,000,000 × 1,000 data frame on an M1 MacBook.

Metadata

Release files for showstats 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for showstats 0.4.0
File Size Uploaded Provenance Actions
showstats-0.4.0.tar.gz 144.5 kB With provenance Details for showstats-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for showstats 0.4.0
File Interpreter ABI Platform Actions
showstats-0.4.0-py3-none-any.whl Python 3 none any Details for showstats-0.4.0-py3-none-any.whl

Total release size: 169.6 kB

Release files / showstats-0.4.0.tar.gz

Download URL showstats-0.4.0.tar.gz
Size 144.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d41a30013a0c440b91c2ebde01053194a70e9b7871e80a2750a4ec0288ccf5c7
BLAKE2b-256 checksum
How to use checksums
d71025603c501f082b166d6150d1e4cb8a46266d8ef79cad70cf0ac606bc0a38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release files / showstats-0.4.0-py3-none-any.whl

Download URL showstats-0.4.0-py3-none-any.whl
Size 25.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80c7dab31f40b5e4853290bd64e1f05b067dad8e8e3b2905a4e0242ea2c49308
BLAKE2b-256 checksum
How to use checksums
a1a55688de96520a5c1b0ddc8b588b839acff1e63992bf0e9c07eece7a9dc458
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Security for showstats 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for showstats-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page