-
Notifications
You must be signed in to change notification settings - Fork 1
/
print_utils.py
57 lines (39 loc) · 1.15 KB
/
print_utils.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import numpy as np
import pandas as pd
def _process_list(info, prefix):
if not isinstance(info, str):
info = info.__str__()
info_list = info.split('\n')
if len(info_list) > 1:
lines = []
for it in info_list:
lines.append(prefix + it)
print('\n'.join(lines))
else:
print(prefix + info)
def part_print(info):
print('='*4, info, '='*4)
def print_h1(info):
_process_list(info, '- ')
def print_h2(info):
_process_list(info, ' * ')
def print_h3(info):
_process_list(info, ' + ')
def print_h4(info):
_process_list(info, ' ~ ')
if __name__ == "__main__":
arr = np.array([1,2,3,3,3,1])
df = pd.DataFrame(arr)
part_print('Label Distribution Check')
print_h1('y train check')
print_h2(df.value_counts())
print_h3('label 1 cnt valid')
print_h3('label 2 cnt valid')
print_h1('y valid check')
print_h2(df.value_counts())
print_h3('label 1 cnt valid')
print_h3('label 2 cnt valid')
print_h1('y test check')
print_h2(df.value_counts())
print_h3('label 1 cnt valid')
print_h3('label 2 cnt valid')