forked from ydataai/ydata-profiling
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_issue85.py
36 lines (31 loc) · 1.03 KB
/
test_issue85.py
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
31
32
33
34
35
36
"""
Test for issue 85:
https://github.com/pandas-profiling/pandas-profiling/issues/85
"""
import pandas as pd
import numpy as np
from pandas_profiling import ProfileReport
from pandas_profiling.model.base import Variable
def test_issue85():
data = {
"booleans_type": [False, True, True],
"booleans_type_nan": [False, True, np.nan],
"integers": [1, 0, 0],
"integers_nan": [1, 0, np.nan],
"str_yes_no": ["Y", "N", "Y"],
"str_yes_no_mixed": ["Y", "n", "y"],
"str_yes_no_nana": ["Y", "N", np.nan],
"str_true_false": ["True", "False", "False"],
"str_true_false_nan": ["True", "False", np.nan],
}
df = pd.DataFrame(data)
report = ProfileReport(
df,
pool_size=1,
title="Dataset with <em>Boolean</em> Variables",
samples={"head": 20},
)
for col, variable_stats in report.get_description()["variables"].items():
assert (
variable_stats["type"] == Variable.TYPE_BOOL
), "Variable should be boolean"