Enquètegegevens analyseren in Python
EbunOluwa Andrew
Data Scientist

Voer invoervariabelen in die relevant zijn voor de uitkomstvariabele
Begrijp de impact van variabelen op de populatie
Check of verschillen toeval zijn of statistisch significant

| pet_type | current_pets | time_spent | reduces_stress |
|---|---|---|---|
| dog | 1 | 420 | yes |
| dog | 1 | 180 | yes |
| dog | 4 | 30 | yes |
| dog | 1 | 30 | yes |
| dog | 1 | 60 | yes |
pet_typereduces_stressimport pandas as pd import scipy.stats as st data = pd.read_csv('pet_survey.csv')cross_table = pd.crosstab(data.reduces_stress, data.pet_type)chi_analysis = st.chi2_contingency(cross_table)print(chi_analysis)
|--------------------------|
| (67.7, |
| 1.9e-16, |
| 1, |
| array([[1767.0, 1825.0], |
| [2251.0, 2325.0]])) |
Frequenties >= 5
p-waarde < 0.05
pet_owned en reduces_stress hangen samenHet type huisdier beïnvloedt of eigenaren stressreductie ervaren

Enquètegegevens analyseren in Python