Interview Query

t Value via Pandas

1
Have you seen this question before?

You are given a dataframe with a single column, 'var'.

Calculated the t-value for the mean of ‘var’ against a null hypothesis that μ=μ0μ = μ0.

Note: You do not have to calculate the p-value of the test or run the test.

Example:

Input:

mu0 = 1
print(df)
...
   var
0  -34
1   40
2  -89
3    5
4  -26

Output:

def t_score(df) ->
var   -1.015614
dtype: float64
Next question: Search Linked List
.....
Python 3.9.6
Loading editor
Use Shift + Enter to run code