Get startedGet started for free

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.

This exercise is part of the course

Experimental Design in Python

View Course

Exercise instructions

  • 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.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Calculate mean Durability_Score for each Toy_Type
mean_durability = toy_durability.pivot_table(
  values='____', index='____', aggfunc=np.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)
Edit and Run Code