this is the nav!
Workspace
Renatha Vieira/

# Hypothesis Testing in Python

0
Beta

## .mfe-app-workspace-kj242g{position:absolute;top:-8px;}.mfe-app-workspace-11ezf91{display:inline-block;}.mfe-app-workspace-11ezf91:hover .Anchor__copyLink{visibility:visible;}Hypothesis Testing in Python

Run the hidden code cell below to import the data used in this course.

```.mfe-app-workspace-jfrv3u{font-size:13px;line-height:20px;font-family:JetBrainsMonoNL,Menlo,Monaco,'Courier New',monospace;}```# Import pandas
import pandas as pd

# Import the course datasets

### Take Notes

Add notes about the concepts you've learned and code cells with code you want to keep.

``# Add your code snippets here``

### Calculating the sample mean

In pandas, a value's proportion in a categorical DataFrame column can be quickly calculated using the syntax:

`prop = (df['col'] == val).mean()`

### Calculating a z-score

o valor-p é o menor nível de significância com que se rejeitaria a hipótese nula.

## P-VALUE

In order to determine whether to choose the null hypothesis or the alternative hypothesis, you need to calculate a p-value from the z-score.

``````# Calculate the z-score of late_prop_samp
z_score = (late_prop_samp - late_prop_hyp)/std_error

# Calculate the p-value
p_value = 1 - norm.cdf(z_score, loc=0, scale=1)

# Print the p-value
print(p_value)``````

• AI Chat
• Code