-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathrender_common.py
More file actions
30 lines (26 loc) · 940 Bytes
/
render_common.py
File metadata and controls
30 lines (26 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from ydata_profiling.config import Settings
from ydata_profiling.report.presentation.frequency_table_utils import (
extreme_obs_table,
freq_table,
)
def render_common(config: Settings, summary: dict) -> dict:
n_extreme_obs = config.n_extreme_obs
n_freq_table_max = config.n_freq_table_max
template_variables = {
"freq_table_rows": freq_table(
freqtable=summary["value_counts_without_nan"],
n=summary["n"],
max_number_to_print=n_freq_table_max,
),
"firstn_expanded": extreme_obs_table(
freqtable=summary["value_counts_index_sorted"],
number_to_print=n_extreme_obs,
n=summary["n"],
),
"lastn_expanded": extreme_obs_table(
freqtable=summary["value_counts_index_sorted"][::-1],
number_to_print=n_extreme_obs,
n=summary["n"],
),
}
return template_variables