@@ -8,11 +8,11 @@ class Engezny:
8
8
def __init__ (self , DataFrame ):
9
9
self .DataFrame = DataFrame
10
10
11
- def labelcolor (self , colors ):
11
+ def __labelcolor (self , colors ):
12
12
rgb = [tuple (int (item .lstrip ('#' )[i :i + 2 ], 16 ) for i in (0 , 2 , 4 )) for item in color ]
13
13
return ["white" if (0.2126 * item [0 ] + 0.7152 * item [1 ] + 0.0722 * item [2 ]) < 128 else "black" for item in rgb ]
14
14
15
- def value_counts (self , Data , multi_sep = None , single_sep = None ):
15
+ def __value_counts (self , Data , multi_sep = None , single_sep = None ):
16
16
if multi_sep == None and single_sep == None :
17
17
return dict (Data .value_counts ())
18
18
Dict = dict ()
@@ -30,7 +30,7 @@ def value_counts(self, Data, multi_sep=None, single_sep=None):
30
30
return dict (sorted (Dict .items (), key = lambda item : item [1 ], reverse = True ))
31
31
32
32
33
- def save (self , location , Count , extention , item ):
33
+ def __save (self , location , Count , extention , item ):
34
34
Title = '{}' .format (item ).title ()
35
35
Title = '' .join (e for e in Title if e .isalnum ())
36
36
try :
@@ -54,7 +54,7 @@ def visualize(self,
54
54
other = False ):
55
55
Count = 1
56
56
for item in list (self .DataFrame )[start :end ]:
57
- Dict = self .value_counts (self .DataFrame [item ], multi_sep , single_sep )
57
+ Dict = self .__value_counts (self .DataFrame [item ], multi_sep , single_sep )
58
58
if Dict == "Error" :
59
59
continue
60
60
@@ -91,7 +91,7 @@ def visualize(self,
91
91
Keys [i ] += " (" + labels [i ].split ()[0 ] + ")"
92
92
93
93
_ , _ , autotexts = plt .pie (Values , labels = ["" for k in Keys ], autopct = "%.1f%%" , colors = colors )
94
- for color , autotext in zip (self .labelcolor (colors ), autotexts ):
94
+ for color , autotext in zip (self .__labelcolor (colors ), autotexts ):
95
95
autotext .set_color (color )
96
96
plt .legend (loc = 'lower center' , bbox_to_anchor = (0.25 , - 0.1 , 0.5 , 0.5 ), labels = Keys )
97
97
@@ -117,6 +117,6 @@ def visualize(self,
117
117
118
118
plt .title (get_display (arabic_reshaper .reshape (item .title ())), fontsize = 35 )
119
119
if save :
120
- self .save (location , Count , extention , item )
120
+ self .__save (location , Count , extention , item )
121
121
plt .show ()
122
122
Count += 1
0 commit comments