Skip to main content

DataScan.get_tabular_report()

Get a tabular report of the scan.

Usage

Source

DataScan.get_tabular_report(
    *,
    show_sample_data=False,
)

The report presents the profile of each column as one row of a table: the column’s name and type, the number and fraction of missing and distinct values, and its statistics. It’s the quickest way to get an overview of a table you haven’t seen before, and it’s what col_summary_tbl() returns.

Each row starts with an icon for the column’s type. The NA and Unique columns give the number of missing values and the number of distinct values, each with its fraction of the rows below it. Statistics that don’t apply to any column are left out, and those that don’t apply to a particular column are shown as an em dash (—). Statistics for string columns describe the lengths of the strings (as the note below the table says). For date, datetime and time columns, Min and Max give the earliest and latest values, with the date and the time on lines of their own; the time is shown to the second, and hovering over a value shows it in full. Boolean columns show the percentages of True and False values in place of the number of distinct values. Columns of unsupported types are listed with an unsupported type badge and no statistics.

Parameters

show_sample_data: bool = False
Should a column with the first five non-missing values of each column be added? This is off by default, since the values can be long, and the table may hold sensitive data.

Returns

GT
A Great Tables object.

Examples

Let’s scan the game_revenue dataset and look at the report.

import pointblank as pb

game_revenue = pb.load_dataset(dataset="game_revenue", tbl_type="polars")

scan = pb.DataScan(game_revenue, tbl_name="game_revenue")

scan.get_tabular_report()
Polarsgame_revenueRows2,000Columns11
Column NA Unique Mean SD Min P5 Q1 Med Q3 P95 Max IQR
string
player_id
String
0
0
76
0.04
15 0 15 15 15 15 15 15 15 0
string
session_id
String
0
0
618
0.31
24 0 24 24 24 24 24 24 24 0
date
session_start
Datetime(time_unit='us', time_zone='UTC')
0
0
618
0.31
— —
2015-01-01
01:31:03
— — — — —
2015-01-21
03:59:23
—
date
time
Datetime(time_unit='us', time_zone='UTC')
0
0
1989
0.99
— —
2015-01-01
01:31:27
— — — — —
2015-01-21
04:06:29
—
string
item_type
String
0
0
2
<.01
2.22 0.42 2 2 2 2 2 3 3 0
string
item_name
String
0
0
24
0.01
7.35 1.27 5 5 7 8 8 9 11 1
numeric
item_revenue
Float64
0
0
508
0.25
4.34 13.21 0 0.02 0.09 0.38 1.25 21.99 142.99 1.16
numeric
session_duration
Float64
0
0
310
0.15
25.63 9.55 3.2 8.2 18.5 26.5 33.82 39.5 41 15.32
date
start_day
Date
0
0
20
0.01
— —
2015-01-01
— — — — —
2015-01-21
—
string
acquisition
String
0
0
6
<.01
7.97 2.54 5 6 7 7 8 14 14 1
string
country
String
0
0
23
0.01
8.53 3.13 5 5 6 7 12 13 14 6
For string columns, the statistics describe the lengths of the strings.

The header shows the table type and its dimensions. In the rows, item_revenue has a long right tail (its 95th percentile is far below its maximum), and the string columns player_id and session_id have fixed lengths. To see what the values look like, add the sample data:

scan.get_tabular_report(show_sample_data=True)
Polarsgame_revenueRows2,000Columns11
Column NA Unique Mean SD Min P5 Q1 Med Q3 P95 Max IQR sample_data
string
player_id
String
0
0
76
0.04
15 0 15 15 15 15 15 15 15 0 ['ECPANOIXLZHF896', 'ECPANOIXLZHF896', 'ECPANOIXLZHF896', 'ECPANOIXLZHF896', 'ECPANOIXLZHF896']
string
session_id
String
0
0
618
0.31
24 0 24 24 24 24 24 24 24 0 ['ECPANOIXLZHF896-eol2j8bs', 'ECPANOIXLZHF896-eol2j8bs', 'ECPANOIXLZHF896-eol2j8bs', 'ECPANOIXLZHF896-eol2j8bs', 'ECPANOIXLZHF896-hdu9jkls']
date
session_start
Datetime(time_unit='us', time_zone='UTC')
0
0
618
0.31
— —
2015-01-01
01:31:03
— — — — —
2015-01-21
03:59:23
— ['2015-01-01 01:31:03+00:00', '2015-01-01 01:31:03+00:00', '2015-01-01 01:31:03+00:00', '2015-01-01 01:31:03+00:00', '2015-01-01 11:50:02+00:00']
date
time
Datetime(time_unit='us', time_zone='UTC')
0
0
1989
0.99
— —
2015-01-01
01:31:27
— — — — —
2015-01-21
04:06:29
— ['2015-01-01 01:31:27+00:00', '2015-01-01 01:36:57+00:00', '2015-01-01 01:37:45+00:00', '2015-01-01 01:42:33+00:00', '2015-01-01 11:55:20+00:00']
string
item_type
String
0
0
2
<.01
2.22 0.42 2 2 2 2 2 3 3 0 ['iap', 'iap', 'iap', 'ad', 'ad']
string
item_name
String
0
0
24
0.01
7.35 1.27 5 5 7 8 8 9 11 1 ['offer2', 'gems3', 'gold7', 'ad_20sec', 'ad_5sec']
numeric
item_revenue
Float64
0
0
508
0.25
4.34 13.21 0 0.02 0.09 0.38 1.25 21.99 142.99 1.16 ['8.99', '22.49', '107.99', '0.76', '0.03']
numeric
session_duration
Float64
0
0
310
0.15
25.63 9.55 3.2 8.2 18.5 26.5 33.82 39.5 41 15.32 ['16.3', '16.3', '16.3', '16.3', '35.2']
date
start_day
Date
0
0
20
0.01
— —
2015-01-01
— — — — —
2015-01-21
— ['2015-01-01', '2015-01-01', '2015-01-01', '2015-01-01', '2015-01-01']
string
acquisition
String
0
0
6
<.01
7.97 2.54 5 6 7 7 8 14 14 1 ['google', 'google', 'google', 'google', 'google']
string
country
String
0
0
23
0.01
8.53 3.13 5 5 6 7 12 13 14 6 ['Germany', 'Germany', 'Germany', 'Germany', 'Germany']
For string columns, the statistics describe the lengths of the strings.

The samples make it clear that player_id and session_id are codes, and they show the format of each column’s values. The report is a Great Tables object, so it can be saved to a standalone HTML file with its write_raw_html() method.