Skip to content

Commit 6d373d7

Browse files
authored
Update Engezny.py
1 parent de8cd62 commit 6d373d7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Engezny/Engezny.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ class Engezny:
88
def __init__(self, DataFrame):
99
self.DataFrame = DataFrame
1010

11-
def labelcolor(self, colors):
11+
def __labelcolor(self, colors):
1212
rgb = [tuple(int(item.lstrip('#')[i:i+2], 16) for i in (0, 2, 4)) for item in color]
1313
return ["white" if (0.2126*item[0] + 0.7152*item[1] + 0.0722*item[2]) < 128 else "black" for item in rgb]
1414

15-
def value_counts(self, Data, multi_sep=None, single_sep=None):
15+
def __value_counts(self, Data, multi_sep=None, single_sep=None):
1616
if multi_sep == None and single_sep == None:
1717
return dict(Data.value_counts())
1818
Dict = dict()
@@ -30,7 +30,7 @@ def value_counts(self, Data, multi_sep=None, single_sep=None):
3030
return dict(sorted(Dict.items(), key=lambda item: item[1], reverse=True))
3131

3232

33-
def save(self, location, Count, extention, item):
33+
def __save(self, location, Count, extention, item):
3434
Title = '{}'.format(item).title()
3535
Title = ''.join(e for e in Title if e.isalnum())
3636
try:
@@ -54,7 +54,7 @@ def visualize(self,
5454
other= False):
5555
Count = 1
5656
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)
5858
if Dict == "Error":
5959
continue
6060

@@ -91,7 +91,7 @@ def visualize(self,
9191
Keys[i] += " (" + labels[i].split()[0] + ")"
9292

9393
_, _, 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):
9595
autotext.set_color(color)
9696
plt.legend(loc = 'lower center', bbox_to_anchor=(0.25, -0.1, 0.5, 0.5), labels = Keys)
9797

@@ -117,6 +117,6 @@ def visualize(self,
117117

118118
plt.title(get_display(arabic_reshaper.reshape(item.title())), fontsize=35)
119119
if save:
120-
self.save(location, Count, extention, item)
120+
self.__save(location, Count, extention, item)
121121
plt.show()
122122
Count += 1

0 commit comments

Comments
 (0)