Course is Probability & Statistics for Machine Learning & Data Science
Week 4 Programming Assignment AB Testing
Exercise 5: compute_proportion_metrics
Here I need to sum all the values of a column using Pandas series \method like this: series.sum()
I use : x=pd.Series.sum(),
which shows
TypeError: NDFrame._add_numeric_operations..sum() missing 1 required positional argument: ‘self’
Please gives us a proper background of your query. Which course, week, assignment, and exercise? Post your full error (not code).
Also, you posted this in the General Discussions category. Please move it to the correct course category.
Best,
Saif.
Hi @Bhagyashree_Hambarde! For the value of x
you are in the right direction using the sum
method. Notice that data
is already of type pd.Series
so you can call it directly as data.sum()
. For p
, you are getting that error because in the context of the dataclass x
does not exists. What does exists is self.x
but since you are not within any method that has self
within its scope then it is also not available. You can achieve this by using methods but in this case it is way easier to duplicate the code for x
and n
.