+ 1
can't call the class outside of it
I have written this code and I can use it only when I call it inside it like this: class Taraz: def __init__(self, filepath): scores = pd.read_excel(filepath)['point'] self.mean = scores.mean() self.var = scores.var() def score(self, score): return (score - self.mean) / self.var if __name__ == '__main__': taraz = Taraz(path.join(r'C:\Users\dell\Desktop\book1.xlsx')) print(taraz.score(16)) in this form it works properly but when I use print func outside the class it gives an error.I want to know why is that and how can I solve this problem?
3 odpowiedzi
0
Could you put the code in the playgound and link it here? From here it looks like an indentation issue, but you never know.
0
well I'm sure it is not indentation problem.I couldnt enter my code in the play ground. sorry
- 1
Ahh too bad