Aan de slagGa gratis aan de slag

Analyzing toy durability

In product development within the toy industry, it's crucial to understand the durability of toys, particularly when comparing educational toys to recreational ones. Durability can significantly impact customer satisfaction and repeat business. Researchers in a toy manufacturing company have asked you to conduct the analysis of a study comparing the durability of educational toys versus recreational toys. The toy_durability DataFrame contains the results of these tests, with durability scores assigned based on rigorous testing protocols.

The data is available in the toy_durability DataFrame. pandas as pd and from scipy.stats import ttest_ind have been loaded.

Deze oefening maakt deel uit van de cursus

Experimental Design in Python

Cursus bekijken

Oefeninstructies

  • Calculate the mean 'Durability_Score' for both 'Educational' and 'Recreational' toys using a pivot table.
  • Perform an independent samples t-test to compare the durability of 'Educational' and 'Recreational' toys by first separating durability scores by Toy_Type.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Calculate mean Durability_Score for each Toy_Type
mean_durability = toy_durability.pivot_table(
  values='____', index='____', aggfunc="mean")
print(mean_durability)

# Perform t-test
educational_durability = toy_durability[toy_durability['Toy_Type'] == '____']['Durability_Score']
recreational_durability = toy_durability[toy_durability['Toy_Type'] == '____']['Durability_Score']
t_stat, p_val = ttest_ind(____, ____)

print(p_val)
Code bewerken en uitvoeren