Getting error "TypeError: Get_mean.get_mean() takes 1 positional argument but 2 were given" here the code:
import numpy as np
import math
class Get_mean:
def __init__(self, a_list):
self.a_list = a_list
def get_mean(self):
mean_of_list = np.mean(self.a_list)
return mean_of_list
class Get_cov(Get_mean):
def __init__(self, a_list, b_list):
#super().__init__(a_list)
Get_mean.__init__(self, a_list)
#self.a_list = a_list
self.b_list = b_list
def get_cov(self): ####here
a_avg = self.get_mean(self.a_list)
print(a_avg)
b_avg = self.get_mean(self.b_list)
print(b_avg)
covar = sum((self.a_list - a_avg)*(self.b_list - b_avg))
return covar
And I imported this file in a new script,
from stat_class import *
import numpy as np
est = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
obs = [21, 35, 49, 51, 66, 70, 91, 68, 34, 84]
v = Get_mean(est)
v4 = Get_cov(est, obs)
a = v.get_mean()
e = v4.get_cov()
print(a)
print(e)
It works when it "a_avg = self.get_mean()" is. Can anyone give me some help? I trully deeplly really want to understand it.
I want to put the 'est values' in a_list in the "a_avg", and the 'obs values' in b_list in the "b_avg".
But as I mentioned it, it works when "self.get_mean()" <- empty is, but a_avg and b_avg have same values..... what's wrong me?