I’m getting the following error for all the exercises:
bad operand type for abs(): ‘t_gen’
Can someone please help me out?
Hey @MAYANK4,
Your notebook gives an error while compiling.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[18], line 4
1 # Test your code
3 alpha = 0.05
----> 4 reject_nh = reject_nh_t_statistic(t, dof, alpha)
6 print(f"The null hypothesis can be rejected at the {alpha} level of significance: {reject_nh}\n")
8 msg = "" if reject_nh else " not"
Cell In[17], line 17, in reject_nh_t_statistic(t_statistic, dof, alpha)
15 reject = False
16 ### START CODE HERE ###
---> 17 p_value = 2 * (1 - t.cdf(np.abs(t_statistic), dof))
19 if p_value < alpha:
20 reject = True
TypeError: bad operand type for abs(): 't_gen'
Why are you trying to submit such a notebook before resolving the error? Please resolve all the errors first, and then submit your notebook.
Hint: Try to look up the documentation for np.abs
.
Cheers,
Elemento
Thanks… It was just a small mistake. I went through the documentation and coded it down.