I need this class to include the following methods only using self:
- get_summary_stats: should calculate the mean, min and max.
- min_max_scale: converts the array to 0-1 values.
- score_scale: converts the array to zscores.
I'm trying it this way without luck, when you run it it smoothly goes by but when I add the last line it gives me an error saying __init__() takes 1 positional argument but 2 were given
class summary_stats_class():
def __init__(self):
min_my_list = min(self)
max_my_list = max(self)
mean_my_list = sum(self)/len(self)
std_my_list = np.std(self)
def get_summary_stats(self):
print(min_my_list,max_my_list,mean_my_list)
def min_max_scale(self):
print((i - min_my_list) / (max_my_list-mean_my_list) for i in self)
def zscore_scale(self):
print((i - mean_my_list) / std_my_list for i in self)
summary_stats_class([1,2,3,4,5,6,7,8,9,10])
I've tried
1)adding list to summary_stats_class(list) because I read it in other question, as well as
2)adding self.list = [] after __init__ piece and finally
3) adding , *args, **kwargs to each method without any luck, could someone please help? Thanks in advance!