import pandas as pd
from rich import print
from skimpy import generate_test_data, skim_get_data
df = generate_test_data()
summary = skim_get_data(df)Features
Skimpy provides:
- a way to create summary statistics of pandas or Polars dataframes, using the skim() function, and print them to your console via the rich package
- support for summarising boolean, numeric, datetime, date, timedelta, string, and category datatypes
- a command line interface to skim CSV, parquet, and SQLite files
- intelligent rounding of numerical values to 4 significant figures
- a way to export the visual summary statistics to lossless formats namely SVG or HTML, or to plain text
- a way to further work with the summary statistics, by returning them as a dictionary
- a way to clean up messy column names in both pandas and Polars dataframes
When using skimpy, please be aware that numerical columns are rounded to 4 significant figures. You should also be aware that any timezone-aware datetimes are converted into their naive equivalents.
You can find a full guide to the API on the reference pages.
Skim a dataframe and return the statistics
To use skim() in its default mode, see the quickstart on the homepage.
If you want to export your results to a dictionary within Python, rather than printing them to console, use the skim_get_data() function instead. Let’s see an example:
And the dictionary has contents as follows:
print(summary){ 'Data Summary': {'Number of rows': 1000, 'Number of columns': 13}, 'Data Types': { 'float64': 3, 'category': 2, 'datetime64[ns]': 2, 'object': 2, 'int64': 1, 'bool': 1, 'string': 1, 'timedelta64[ns]': 1 }, 'Categories': {'Columns': {'location', 'class'}}, 'number': { 'NA': {'length': 0, 'width': 0, 'depth': 0, 'rnd': 118}, 'NA %': {'length': 0.0, 'width': 0.0, 'depth': 0.0, 'rnd': 11.8}, 'mean': {'length': 0.5016, 'width': 2.037, 'depth': 10.02, 'rnd': -0.01977}, 'sd': {'length': 0.3597, 'width': 1.929, 'depth': 3.208, 'rnd': 1.002}, 'p0': {'length': 1.573e-06, 'width': 0.002057, 'depth': 2.0, 'rnd': -2.809}, 'p25': {'length': 0.134, 'width': 0.603, 'depth': 8.0, 'rnd': -0.7355}, 'p50': {'length': 0.4976, 'width': 1.468, 'depth': 10.0, 'rnd': -0.0007736}, 'p75': {'length': 0.8602, 'width': 2.953, 'depth': 12.0, 'rnd': 0.6639}, 'p100': {'length': 1.0, 'width': 13.91, 'depth': 20.0, 'rnd': 3.717}, 'hist': {'length': '█▃▃▃▄█', 'width': '█▃▁ ', 'depth': '▁▄█▆▃▁', 'rnd': '▁▄█▅▁ '} }, 'category': { 'NA': {'class': 0, 'location': 1}, 'NA %': {'class': 0.0, 'location': 0.1}, 'ordered': {'class': False, 'location': False}, 'unique': {'class': 2, 'location': 5} }, 'bool': {'true': {'booly_col': 516}, 'true rate': {'booly_col': 0.52}, 'hist': {'booly_col': '█ █'}}, 'datetime': { 'NA': {'datetime': 0, 'datetime_no_freq': 3}, 'NA %': {'datetime': 0.0, 'datetime_no_freq': 0.3}, 'first': { 'datetime': Timestamp('2018-01-31 00:00:00'), 'datetime_no_freq': Timestamp('1992-01-05 00:00:00') }, 'last': { 'datetime': Timestamp('2101-04-30 00:00:00'), 'datetime_no_freq': Timestamp('2023-03-04 00:00:00') }, 'frequency': {'datetime': 'ME', 'datetime_no_freq': nan} }, 'date': { 'NA': {'datetime.date': 0, 'datetime.date_no_freq': 0}, 'NA %': {'datetime.date': 0.0, 'datetime.date_no_freq': 0.0}, 'first': { 'datetime.date': datetime.date(2018, 1, 31), 'datetime.date_no_freq': datetime.date(1992, 1, 5) }, 'last': {'datetime.date': datetime.date(2101, 4, 30), 'datetime.date_no_freq': datetime.date(2023, 3, 4)}, 'frequency': {'datetime.date': 'ME', 'datetime.date_no_freq': nan} }, 'timedelta64[ns]': { 'NA': {'time diff': 5}, 'NA %': {'time diff': 0.5}, 'mean': {'time diff': Timedelta('8 days 00:05:47')}, 'median': {'time diff': Timedelta('6 days 00:00:00')}, 'max': {'time diff': Timedelta('26 days 00:00:00')} }, 'string': { 'NA': {'text': 6}, 'NA %': {'text': 0.6}, 'shortest': {'text': 'How are you?'}, 'longest': {'text': 'Indeed, it was the most outrageously pompous cat I have ever seen.'}, 'min': {'text': 'How are you?'}, 'max': {'text': 'What weather!'}, 'chars per row': {'text': 31.1}, 'words per row': {'text': 5.8}, 'total words': {'text': 5761} }, 'object': { 'NA': {'datetime.date': 0, 'datetime.date_no_freq': 0}, 'NA %': {'datetime.date': 0.0, 'datetime.date_no_freq': 0.0} } }
The dictionary has one entry per section of the printed summary: "Data Summary", "Data Types", "Categories" (if there are any category columns), and then one entry for each kind of column that is present, such as "number" or "date".
What skim summarises
skim() groups columns by type and prints a separate table for each group. The statistics in each table are:
| Section | Column types | Statistics |
|---|---|---|
| number | integers and floats | NA, NA %, mean, sd, p0, p25, p50, p75, p100, hist |
| category | pandas category |
NA, NA %, ordered, unique |
| bool | booleans | true, true rate, hist |
| datetime | datetime64 (timezone-aware values are made naive) |
NA, NA %, first, last, frequency* |
| date | Python datetime.date objects |
NA, NA %, first, last, frequency* |
| timedelta64[ns] | durations | NA, NA %, mean, median, max |
| string | strings (including object columns that contain only strings) | NA, NA %, shortest, longest, min, max, chars per row, words per row, total words |
| All null | columns where every value is missing | NA, NA % |
* frequency is the regular spacing of the dates that pandas infers (for example ME for month end), and only appears when there are more than three rows.
NA is the number of missing values and NA % is the percentage of the column that is missing. The hist column is a small unicode histogram of the values. For strings, min and max are the first and last values in alphabetical order, while shortest and longest are by number of characters.
Before summarising, skimpy infers a type for every column. You will usually get the best results if you set the datatypes you want yourself first (for example, df["col"].astype("category")).
Columns that are left out
Columns whose values are a mix of types (for example, numbers and strings in the same column) can’t be summarised, so skim() leaves them out of the summary. If every column is of a mixed type, you’ll get a ValueError instead.
Dataframes with a multi-level column index (a pandas.MultiIndex) are not supported and raise a NotImplementedError. Flatten the columns first, for example with df.columns = ["_".join(map(str, c)) for c in df.columns].
Duplicate column names
If a dataframe has more than one column with the same name, skimpy gives the repeats a numbered suffix for the summary only, and tells you with a warning. Your dataframe is not changed.
import warnings
dup_df = pd.DataFrame([[1, 2, 3], [4, 5, 6]], columns=["a", "a", "b"])
with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
dup_summary = skim_get_data(dup_df)
print(caught[0].message)
print(list(dup_summary["number"]["mean"].keys()))Duplicate column names were renamed for this summary: 'a' -> a_1. Your dataframe has not been changed.
['a', 'a_1', 'b']
Naming the summary
If your dataframe has a name attribute, it is used as the heading of the “Data Summary” table in place of “Dataframe”:
from skimpy import skim
named_df = generate_test_data()
named_df.name = "Test data"
skim(named_df)╭──────────────────────────────────────────────── skimpy summary ─────────────────────────────────────────────────╮ │ Data Summary Data Types Categories │ │ ┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓ ┏━━━━━━━━━━━━━┳━━━━━━━┓ ┏━━━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ Test data ┃ Values ┃ ┃ Column Type ┃ Count ┃ ┃ Categorical Variables ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━┩ ┡━━━━━━━━━━━━━╇━━━━━━━┩ ┡━━━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ Number of rows │ 1000 │ │ float64 │ 3 │ │ class │ │ │ │ Number of columns │ 13 │ │ category │ 2 │ │ location │ │ │ └───────────────────┴────────┘ │ datetime64 │ 2 │ └───────────────────────┘ │ │ │ object │ 2 │ │ │ │ int64 │ 1 │ │ │ │ bool │ 1 │ │ │ │ string │ 1 │ │ │ │ timedelta64 │ 1 │ │ │ └─────────────┴───────┘ │ │ number │ │ ┏━━━━━━━━━┳━━━━━━┳━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ mean ┃ sd ┃ p0 ┃ p25 ┃ p50 ┃ p75 ┃ p100 ┃ hist ┃ │ │ ┡━━━━━━━━━╇━━━━━━╇━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━┩ │ │ │ length │ 0 │ 0 │ 0.5016 │ 0.3597 │ 1.573e-06 │ 0.134 │ 0.4976 │ 0.8602 │ 1 │ █▃▃▃▄█ │ │ │ │ width │ 0 │ 0 │ 2.037 │ 1.929 │ 0.002057 │ 0.603 │ 1.468 │ 2.953 │ 13.91 │ █▃▁ │ │ │ │ depth │ 0 │ 0 │ 10.02 │ 3.208 │ 2 │ 8 │ 10 │ 12 │ 20 │ ▁▄█▆▃▁ │ │ │ │ rnd │ 118 │ 11.8 │ -0.01977 │ 1.002 │ -2.809 │ -0.7355 │ -0.0007736 │ 0.6639 │ 3.717 │ ▁▄█▅▁ │ │ │ └─────────┴──────┴───────┴───────────┴─────────┴────────────┴─────────┴────────────┴────────┴───────┴────────┘ │ │ category │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ ordered ┃ unique ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ class │ 0 │ 0 │ False │ 2 │ │ │ │ location │ 1 │ 0.1 │ False │ 5 │ │ │ └─────────────────────────────┴────────────┴─────────────────┴─────────────────────────┴─────────────────────┘ │ │ bool │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ true ┃ true rate ┃ hist ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ booly_col │ 516 │ 0.52 │ █ █ │ │ │ └─────────────────────────────────┴──────────────────┴────────────────────────────────┴──────────────────────┘ │ │ datetime │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ first ┃ last ┃ frequency ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ │ │ │ datetime │ 0 │ 0 │ 2018-01-31 │ 2101-04-30 │ ME │ │ │ │ datetime_no_freq │ 3 │ 0.3 │ 1992-01-05 │ 2023-03-04 │ nan │ │ │ └──────────────────────────────┴───────┴──────────┴────────────────────┴───────────────────┴─────────────────┘ │ │ date │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ first ┃ last ┃ frequency ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩ │ │ │ datetime.date │ 0 │ 0 │ 2018-01-31 │ 2101-04-30 │ ME │ │ │ │ datetime.date_no_freq │ 0 │ 0 │ 1992-01-05 │ 2023-03-04 │ nan │ │ │ └───────────────────────────────────┴───────┴─────────┴──────────────────┴──────────────────┴────────────────┘ │ │ timedelta64 │ │ ┏━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ mean ┃ median ┃ max ┃ │ │ ┡━━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ time diff │ 5 │ 0.5 │ 8 days 00:05:47 │ 6 days 00:00:00 │ 26 days 00:00:00 │ │ │ └────────────────┴──────┴─────────┴────────────────────────┴────────────────────────┴────────────────────────┘ │ │ string │ │ ┏━━━━━━━━┳━━━━┳━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┓ │ │ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ chars per ┃ words per ┃ total ┃ │ │ ┃ column ┃ NA ┃ NA % ┃ shortest ┃ longest ┃ min ┃ max ┃ row ┃ row ┃ words ┃ │ │ ┡━━━━━━━━╇━━━━╇━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━┩ │ │ │ text │ 6 │ 0.6 │ How are │ Indeed, │ How are │ What │ 31.1 │ 5.8 │ 5761 │ │ │ │ │ │ │ you? │ it was │ you? │ weather! │ │ │ │ │ │ │ │ │ │ │ the most │ │ │ │ │ │ │ │ │ │ │ │ │ outrageou │ │ │ │ │ │ │ │ │ │ │ │ │ sly │ │ │ │ │ │ │ │ │ │ │ │ │ pompous │ │ │ │ │ │ │ │ │ │ │ │ │ cat I │ │ │ │ │ │ │ │ │ │ │ │ │ have ever │ │ │ │ │ │ │ │ │ │ │ │ │ seen. │ │ │ │ │ │ │ │ └────────┴────┴──────┴────────────┴───────────┴────────────┴───────────┴────────────┴───────────┴────────────┘ │ │ object │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩ │ │ │ datetime.date │ 0 │ 0 │ │ │ │ datetime.date_no_freq │ 0 │ 0 │ │ │ └──────────────────────────────────────────────────────────────────────────┴─────────────┴───────────────────┘ │ ╰────────────────────────────────────────────────────── End ──────────────────────────────────────────────────────╯
Clean up messy dataframe column names
skimpy also comes with a clean_columns function as a convenience (with thanks to the dataprep package). This slugifies column names in pandas and Polars dataframes. For example,
from skimpy import clean_columns
columns = [
"bs lncs;n edbn ",
"Nín hǎo. Wǒ shì zhōng guó rén",
"___This is a test___",
"ÜBER Über German Umlaut",
]
messy_df = pd.DataFrame(columns=columns, index=[0], data=[range(len(columns))])
print("Column names:")
print(list(messy_df.columns))Column names:
['bs lncs;n edbn ', 'Nín hǎo. Wǒ shì zhōng guó rén', '___This is a test___', 'ÜBER Über German Umlaut']
Now let’s clean these—by default what we get back is in snake case:
clean_df = clean_columns(messy_df)
print(list(clean_df.columns))['bs_lncs_n_edbn', 'nin_hao_wo_shi_zhong_guo_ren', 'this_is_a_test', 'uber_uber_german_umlaut']
Case styles
Choose a naming convention with the case argument. These are all of the options:
case |
Result |
|---|---|
"snake" (default) |
column_name |
"kebab" |
column-name |
"camel" |
columnName |
"pascal" |
ColumnName |
"const" |
COLUMN_NAME |
"sentence" |
Column name |
"title" |
Column Name |
"lower" |
column name |
"upper" |
COLUMN NAME |
For example, camel case:
clean_df = clean_columns(messy_df, case="camel")
print(list(clean_df.columns))['bsLncsNEdbn', 'ninHaoWoShiZhongGuoRen', 'thisIsATest', 'uberUberGermanUmlaut']
The full set is also available in Python as skimpy.CASE_STYLES.
Replacing text and keeping accents
Use replace to swap out parts of column names before they are cleaned. It takes a dictionary of {old: new} pairs. Matching ignores case, and each old value is treated as a regular expression, so escape characters such as . or ( if you mean them literally.
contacts = pd.DataFrame(columns=["FirstNom", "lastName", "Téléphone"])
print(list(clean_columns(contacts, case="camel", replace={"Nom": "Name"}).columns))['firstName', 'lastName', 'telephone']
Accents are removed by default. To keep them, pass remove_accents=False:
print(list(clean_columns(contacts, remove_accents=False).columns))['first_nom', 'last_name', 'téléphone']
Polars and duplicate names
clean_columns works the same way on Polars dataframes, and returns a Polars dataframe. If cleaning makes two names identical, the later ones get a number on the end, joined in the style of the chosen case:
import polars as pl
pl_df = pl.DataFrame({"Total Sales": [1], "total-sales": [2], "TOTAL SALES": [3]})
print(clean_columns(pl_df).columns)
print(clean_columns(pl_df, case="camel").columns)['total_sales', 'total_sales_1', 'total_sales_2']
['totalSales', 'totalSales1', 'totalSales2']
Export the visual summary table to SVG
To export the figure containing the table of summary statistics, use the skim_get_figure() function. This will save an SVG file to the given (relative) path that you pass with the save_path argument. For example,
from skimpy import generate_test_data, skim_get_figure
df = generate_test_data()
skim_get_figure(df, "summary_table.svg")╭──────────────────────────────────────────────── skimpy summary ─────────────────────────────────────────────────╮ │ Data Summary Data Types Categories │ │ ┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓ ┏━━━━━━━━━━━━━┳━━━━━━━┓ ┏━━━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ Dataframe ┃ Values ┃ ┃ Column Type ┃ Count ┃ ┃ Categorical Variables ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━┩ ┡━━━━━━━━━━━━━╇━━━━━━━┩ ┡━━━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ Number of rows │ 1000 │ │ float64 │ 3 │ │ class │ │ │ │ Number of columns │ 13 │ │ category │ 2 │ │ location │ │ │ └───────────────────┴────────┘ │ datetime64 │ 2 │ └───────────────────────┘ │ │ │ object │ 2 │ │ │ │ int64 │ 1 │ │ │ │ bool │ 1 │ │ │ │ string │ 1 │ │ │ │ timedelta64 │ 1 │ │ │ └─────────────┴───────┘ │ │ number │ │ ┏━━━━━━━━━┳━━━━━━┳━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ mean ┃ sd ┃ p0 ┃ p25 ┃ p50 ┃ p75 ┃ p100 ┃ hist ┃ │ │ ┡━━━━━━━━━╇━━━━━━╇━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━┩ │ │ │ length │ 0 │ 0 │ 0.5016 │ 0.3597 │ 1.573e-06 │ 0.134 │ 0.4976 │ 0.8602 │ 1 │ █▃▃▃▄█ │ │ │ │ width │ 0 │ 0 │ 2.037 │ 1.929 │ 0.002057 │ 0.603 │ 1.468 │ 2.953 │ 13.91 │ █▃▁ │ │ │ │ depth │ 0 │ 0 │ 10.02 │ 3.208 │ 2 │ 8 │ 10 │ 12 │ 20 │ ▁▄█▆▃▁ │ │ │ │ rnd │ 118 │ 11.8 │ -0.01977 │ 1.002 │ -2.809 │ -0.7355 │ -0.0007736 │ 0.6639 │ 3.717 │ ▁▄█▅▁ │ │ │ └─────────┴──────┴───────┴───────────┴─────────┴────────────┴─────────┴────────────┴────────┴───────┴────────┘ │ │ category │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ ordered ┃ unique ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ class │ 0 │ 0 │ False │ 2 │ │ │ │ location │ 1 │ 0.1 │ False │ 5 │ │ │ └─────────────────────────────┴────────────┴─────────────────┴─────────────────────────┴─────────────────────┘ │ │ bool │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ true ┃ true rate ┃ hist ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ booly_col │ 516 │ 0.52 │ █ █ │ │ │ └─────────────────────────────────┴──────────────────┴────────────────────────────────┴──────────────────────┘ │ │ datetime │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ first ┃ last ┃ frequency ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ │ │ │ datetime │ 0 │ 0 │ 2018-01-31 │ 2101-04-30 │ ME │ │ │ │ datetime_no_freq │ 3 │ 0.3 │ 1992-01-05 │ 2023-03-04 │ nan │ │ │ └──────────────────────────────┴───────┴──────────┴────────────────────┴───────────────────┴─────────────────┘ │ │ date │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ first ┃ last ┃ frequency ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩ │ │ │ datetime.date │ 0 │ 0 │ 2018-01-31 │ 2101-04-30 │ ME │ │ │ │ datetime.date_no_freq │ 0 │ 0 │ 1992-01-05 │ 2023-03-04 │ nan │ │ │ └───────────────────────────────────┴───────┴─────────┴──────────────────┴──────────────────┴────────────────┘ │ │ timedelta64 │ │ ┏━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ mean ┃ median ┃ max ┃ │ │ ┡━━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ time diff │ 5 │ 0.5 │ 8 days 00:05:47 │ 6 days 00:00:00 │ 26 days 00:00:00 │ │ │ └────────────────┴──────┴─────────┴────────────────────────┴────────────────────────┴────────────────────────┘ │ │ string │ │ ┏━━━━━━━━┳━━━━┳━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┓ │ │ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ chars per ┃ words per ┃ total ┃ │ │ ┃ column ┃ NA ┃ NA % ┃ shortest ┃ longest ┃ min ┃ max ┃ row ┃ row ┃ words ┃ │ │ ┡━━━━━━━━╇━━━━╇━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━┩ │ │ │ text │ 6 │ 0.6 │ How are │ Indeed, │ How are │ What │ 31.1 │ 5.8 │ 5761 │ │ │ │ │ │ │ you? │ it was │ you? │ weather! │ │ │ │ │ │ │ │ │ │ │ the most │ │ │ │ │ │ │ │ │ │ │ │ │ outrageou │ │ │ │ │ │ │ │ │ │ │ │ │ sly │ │ │ │ │ │ │ │ │ │ │ │ │ pompous │ │ │ │ │ │ │ │ │ │ │ │ │ cat I │ │ │ │ │ │ │ │ │ │ │ │ │ have ever │ │ │ │ │ │ │ │ │ │ │ │ │ seen. │ │ │ │ │ │ │ │ └────────┴────┴──────┴────────────┴───────────┴────────────┴───────────┴────────────┴───────────┴────────────┘ │ │ object │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩ │ │ │ datetime.date │ 0 │ 0 │ │ │ │ datetime.date_no_freq │ 0 │ 0 │ │ │ └──────────────────────────────────────────────────────────────────────────┴─────────────┴───────────────────┘ │ ╰────────────────────────────────────────────────────── End ──────────────────────────────────────────────────────╯
You can also specify other formats, such as HTML or text:
skim_get_figure(df, "summary_table.html", format="html")
skim_get_figure(df, "summary_table.txt", format="text")╭──────────────────────────────────────────────── skimpy summary ─────────────────────────────────────────────────╮ │ Data Summary Data Types Categories │ │ ┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓ ┏━━━━━━━━━━━━━┳━━━━━━━┓ ┏━━━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ Dataframe ┃ Values ┃ ┃ Column Type ┃ Count ┃ ┃ Categorical Variables ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━┩ ┡━━━━━━━━━━━━━╇━━━━━━━┩ ┡━━━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ Number of rows │ 1000 │ │ float64 │ 3 │ │ class │ │ │ │ Number of columns │ 13 │ │ category │ 2 │ │ location │ │ │ └───────────────────┴────────┘ │ datetime64 │ 2 │ └───────────────────────┘ │ │ │ object │ 2 │ │ │ │ int64 │ 1 │ │ │ │ bool │ 1 │ │ │ │ string │ 1 │ │ │ │ timedelta64 │ 1 │ │ │ └─────────────┴───────┘ │ │ number │ │ ┏━━━━━━━━━┳━━━━━━┳━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ mean ┃ sd ┃ p0 ┃ p25 ┃ p50 ┃ p75 ┃ p100 ┃ hist ┃ │ │ ┡━━━━━━━━━╇━━━━━━╇━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━┩ │ │ │ length │ 0 │ 0 │ 0.5016 │ 0.3597 │ 1.573e-06 │ 0.134 │ 0.4976 │ 0.8602 │ 1 │ █▃▃▃▄█ │ │ │ │ width │ 0 │ 0 │ 2.037 │ 1.929 │ 0.002057 │ 0.603 │ 1.468 │ 2.953 │ 13.91 │ █▃▁ │ │ │ │ depth │ 0 │ 0 │ 10.02 │ 3.208 │ 2 │ 8 │ 10 │ 12 │ 20 │ ▁▄█▆▃▁ │ │ │ │ rnd │ 118 │ 11.8 │ -0.01977 │ 1.002 │ -2.809 │ -0.7355 │ -0.0007736 │ 0.6639 │ 3.717 │ ▁▄█▅▁ │ │ │ └─────────┴──────┴───────┴───────────┴─────────┴────────────┴─────────┴────────────┴────────┴───────┴────────┘ │ │ category │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ ordered ┃ unique ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ class │ 0 │ 0 │ False │ 2 │ │ │ │ location │ 1 │ 0.1 │ False │ 5 │ │ │ └─────────────────────────────┴────────────┴─────────────────┴─────────────────────────┴─────────────────────┘ │ │ bool │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ true ┃ true rate ┃ hist ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ booly_col │ 516 │ 0.52 │ █ █ │ │ │ └─────────────────────────────────┴──────────────────┴────────────────────────────────┴──────────────────────┘ │ │ datetime │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ first ┃ last ┃ frequency ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ │ │ │ datetime │ 0 │ 0 │ 2018-01-31 │ 2101-04-30 │ ME │ │ │ │ datetime_no_freq │ 3 │ 0.3 │ 1992-01-05 │ 2023-03-04 │ nan │ │ │ └──────────────────────────────┴───────┴──────────┴────────────────────┴───────────────────┴─────────────────┘ │ │ date │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ first ┃ last ┃ frequency ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩ │ │ │ datetime.date │ 0 │ 0 │ 2018-01-31 │ 2101-04-30 │ ME │ │ │ │ datetime.date_no_freq │ 0 │ 0 │ 1992-01-05 │ 2023-03-04 │ nan │ │ │ └───────────────────────────────────┴───────┴─────────┴──────────────────┴──────────────────┴────────────────┘ │ │ timedelta64 │ │ ┏━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ mean ┃ median ┃ max ┃ │ │ ┡━━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ time diff │ 5 │ 0.5 │ 8 days 00:05:47 │ 6 days 00:00:00 │ 26 days 00:00:00 │ │ │ └────────────────┴──────┴─────────┴────────────────────────┴────────────────────────┴────────────────────────┘ │ │ string │ │ ┏━━━━━━━━┳━━━━┳━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┓ │ │ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ chars per ┃ words per ┃ total ┃ │ │ ┃ column ┃ NA ┃ NA % ┃ shortest ┃ longest ┃ min ┃ max ┃ row ┃ row ┃ words ┃ │ │ ┡━━━━━━━━╇━━━━╇━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━┩ │ │ │ text │ 6 │ 0.6 │ How are │ Indeed, │ How are │ What │ 31.1 │ 5.8 │ 5761 │ │ │ │ │ │ │ you? │ it was │ you? │ weather! │ │ │ │ │ │ │ │ │ │ │ the most │ │ │ │ │ │ │ │ │ │ │ │ │ outrageou │ │ │ │ │ │ │ │ │ │ │ │ │ sly │ │ │ │ │ │ │ │ │ │ │ │ │ pompous │ │ │ │ │ │ │ │ │ │ │ │ │ cat I │ │ │ │ │ │ │ │ │ │ │ │ │ have ever │ │ │ │ │ │ │ │ │ │ │ │ │ seen. │ │ │ │ │ │ │ │ └────────┴────┴──────┴────────────┴───────────┴────────────┴───────────┴────────────┴───────────┴────────────┘ │ │ object │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩ │ │ │ datetime.date │ 0 │ 0 │ │ │ │ datetime.date_no_freq │ 0 │ 0 │ │ │ └──────────────────────────────────────────────────────────────────────────┴─────────────┴───────────────────┘ │ ╰────────────────────────────────────────────────────── End ──────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────── skimpy summary ─────────────────────────────────────────────────╮ │ Data Summary Data Types Categories │ │ ┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓ ┏━━━━━━━━━━━━━┳━━━━━━━┓ ┏━━━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ Dataframe ┃ Values ┃ ┃ Column Type ┃ Count ┃ ┃ Categorical Variables ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━┩ ┡━━━━━━━━━━━━━╇━━━━━━━┩ ┡━━━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ Number of rows │ 1000 │ │ float64 │ 3 │ │ class │ │ │ │ Number of columns │ 13 │ │ category │ 2 │ │ location │ │ │ └───────────────────┴────────┘ │ datetime64 │ 2 │ └───────────────────────┘ │ │ │ object │ 2 │ │ │ │ int64 │ 1 │ │ │ │ bool │ 1 │ │ │ │ string │ 1 │ │ │ │ timedelta64 │ 1 │ │ │ └─────────────┴───────┘ │ │ number │ │ ┏━━━━━━━━━┳━━━━━━┳━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ mean ┃ sd ┃ p0 ┃ p25 ┃ p50 ┃ p75 ┃ p100 ┃ hist ┃ │ │ ┡━━━━━━━━━╇━━━━━━╇━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━┩ │ │ │ length │ 0 │ 0 │ 0.5016 │ 0.3597 │ 1.573e-06 │ 0.134 │ 0.4976 │ 0.8602 │ 1 │ █▃▃▃▄█ │ │ │ │ width │ 0 │ 0 │ 2.037 │ 1.929 │ 0.002057 │ 0.603 │ 1.468 │ 2.953 │ 13.91 │ █▃▁ │ │ │ │ depth │ 0 │ 0 │ 10.02 │ 3.208 │ 2 │ 8 │ 10 │ 12 │ 20 │ ▁▄█▆▃▁ │ │ │ │ rnd │ 118 │ 11.8 │ -0.01977 │ 1.002 │ -2.809 │ -0.7355 │ -0.0007736 │ 0.6639 │ 3.717 │ ▁▄█▅▁ │ │ │ └─────────┴──────┴───────┴───────────┴─────────┴────────────┴─────────┴────────────┴────────┴───────┴────────┘ │ │ category │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ ordered ┃ unique ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ class │ 0 │ 0 │ False │ 2 │ │ │ │ location │ 1 │ 0.1 │ False │ 5 │ │ │ └─────────────────────────────┴────────────┴─────────────────┴─────────────────────────┴─────────────────────┘ │ │ bool │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ true ┃ true rate ┃ hist ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ booly_col │ 516 │ 0.52 │ █ █ │ │ │ └─────────────────────────────────┴──────────────────┴────────────────────────────────┴──────────────────────┘ │ │ datetime │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ first ┃ last ┃ frequency ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ │ │ │ datetime │ 0 │ 0 │ 2018-01-31 │ 2101-04-30 │ ME │ │ │ │ datetime_no_freq │ 3 │ 0.3 │ 1992-01-05 │ 2023-03-04 │ nan │ │ │ └──────────────────────────────┴───────┴──────────┴────────────────────┴───────────────────┴─────────────────┘ │ │ date │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ first ┃ last ┃ frequency ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩ │ │ │ datetime.date │ 0 │ 0 │ 2018-01-31 │ 2101-04-30 │ ME │ │ │ │ datetime.date_no_freq │ 0 │ 0 │ 1992-01-05 │ 2023-03-04 │ nan │ │ │ └───────────────────────────────────┴───────┴─────────┴──────────────────┴──────────────────┴────────────────┘ │ │ timedelta64 │ │ ┏━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ mean ┃ median ┃ max ┃ │ │ ┡━━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩ │ │ │ time diff │ 5 │ 0.5 │ 8 days 00:05:47 │ 6 days 00:00:00 │ 26 days 00:00:00 │ │ │ └────────────────┴──────┴─────────┴────────────────────────┴────────────────────────┴────────────────────────┘ │ │ string │ │ ┏━━━━━━━━┳━━━━┳━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┓ │ │ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ chars per ┃ words per ┃ total ┃ │ │ ┃ column ┃ NA ┃ NA % ┃ shortest ┃ longest ┃ min ┃ max ┃ row ┃ row ┃ words ┃ │ │ ┡━━━━━━━━╇━━━━╇━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━┩ │ │ │ text │ 6 │ 0.6 │ How are │ Indeed, │ How are │ What │ 31.1 │ 5.8 │ 5761 │ │ │ │ │ │ │ you? │ it was │ you? │ weather! │ │ │ │ │ │ │ │ │ │ │ the most │ │ │ │ │ │ │ │ │ │ │ │ │ outrageou │ │ │ │ │ │ │ │ │ │ │ │ │ sly │ │ │ │ │ │ │ │ │ │ │ │ │ pompous │ │ │ │ │ │ │ │ │ │ │ │ │ cat I │ │ │ │ │ │ │ │ │ │ │ │ │ have ever │ │ │ │ │ │ │ │ │ │ │ │ │ seen. │ │ │ │ │ │ │ │ └────────┴────┴──────┴────────────┴───────────┴────────────┴───────────┴────────────┴───────────┴────────────┘ │ │ object │ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓ │ │ ┃ column ┃ NA ┃ NA % ┃ │ │ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩ │ │ │ datetime.date │ 0 │ 0 │ │ │ │ datetime.date_no_freq │ 0 │ 0 │ │ │ └──────────────────────────────────────────────────────────────────────────┴─────────────┴───────────────────┘ │ ╰────────────────────────────────────────────────────── End ──────────────────────────────────────────────────────╯
The function accepts both pandas and Polars DataFrames. It supports three output formats: SVG (default), HTML, and text. The function also prints the summary to the console; file paths are relative to the current working directory.
Run skim on the command line
You don’t need to be in a Python script or notebook to run skimpy on data! The package comes with a command line utility that can work with CSV, parquet, and SQLite files. When run on CSV files, it uses a powerful duckdb sniffer to guess column types.
You can run this with the below—but note that the command is skimpy, the name of the package, rather than skim, which is the command when used within a Python script or notebook.
$ skimpy file.csv$ skimpy file.parquetFor SQLite databases, choose a table with --table (or its short form, -t):
$ skimpy file.sqlite --table <table name>If you leave out --table, skimpy lists the tables in the database and then stops with an error asking you to choose one:
$ skimpy file.sqlite
Available tables in file.sqlite:
- customers
- orders
...
ValueError: Please specify a table using --table NAME or -t NAME (e.g., skimpy your_db.sqlite -t my_table)To check which version you have installed, or to see the options, use:
$ skimpy --version
$ skimpy --helpSettings
skimpy has a few module-level constants that control what goes into the summary. They are listed on the reference pages:
| Constant | Default | What it controls |
|---|---|---|
| QUANTILES | [0, 0.25, 0.5, 0.75, 1] |
The quantiles shown for number columns (as p0, p25, …) |
| HIST_BINS | 6 |
The number of bins in each unicode histogram |
| MIN_COL_WIDTH, MAX_COL_WIDTH | 6, 40 |
The narrowest and widest a table column can be, in characters |
| MISSING_COL, COMPLETE_COL | "NA", "NA %" |
Headings for the missing-value count and percentage |
| NUM_COL_MEAN | "mean" |
Heading for the mean |
| DATE_COL_FIRST, DATE_COL_LAST | "first", "last" |
Headings for the earliest and latest dates |
| NULL_VALUES | {nan, "", None} |
Column names that clean_columns leaves untouched |
| CASE_STYLES | see above | The allowed values of clean_columns(case=...) |
These are read each time you call a function, so you can change them for a session. For example, to use ten histogram bins:
import skimpy
skimpy.HIST_BINS = 10
print(skim_get_data(generate_test_data())["number"]["hist"])
skimpy.HIST_BINS = 6 # put it back{'length': '█▃▃▂▂▂▂▃▃█', 'width': '█▄▃▁▁ ', 'depth': ' ▂▄█▃▆▄▂▁ ', 'rnd': '▁▂▄▆█▆▃▁ '}