Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Compare Data Distributions with Seaborn | Data Visualization and Mathematical Functions
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Python for Mathematics

bookChallenge: Compare Data Distributions with Seaborn

When you want to compare the performance of different groups—such as classes taking the same test or participants in an experiment—simply looking at averages does not always reveal the whole story. Comparing data distributions allows you to see differences in spread, outliers, and overall patterns. In educational settings, visualizing the test scores from two classes side by side can help identify which class has more consistent results, whether one group has higher outliers, or if both groups share a similar range of scores. Boxplots are a powerful way to summarize and compare these distributions, as they highlight the median, quartiles, and any potential outliers in a compact visual format.

123456789101112131415161718
import random import seaborn as sns import matplotlib.pyplot as plt # Generate random test scores for two classes class_a_scores = [random.randint(60, 100) for _ in range(30)] class_b_scores = [random.randint(55, 98) for _ in range(30)] # Prepare data for seaborn data = [class_a_scores, class_b_scores] labels = ["Class A", "Class B"] # Create side-by-side boxplots sns.boxplot(data=data) plt.xticks([0, 1], labels) plt.ylabel("Test Scores") plt.title("Comparison of Test Score Distributions: Class A vs Class B") plt.show()
copy
Завдання

Swipe to start coding

Write a function that generates two lists of random integers to represent test scores for two different classes. Use seaborn to create side-by-side boxplots comparing the score distributions. Add descriptive labels for the x-axis, y-axis, and a title for the plot.

  • Generate a list of 30 random integers between 60 and 100 for the first class.
  • Generate a list of 30 random integers between 55 and 98 for the second class.
  • Create a side-by-side boxplot comparing the two lists.
  • Label the x-axis with the class names, set a label for the y-axis, and add a plot title.

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 7
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

close

bookChallenge: Compare Data Distributions with Seaborn

Свайпніть щоб показати меню

When you want to compare the performance of different groups—such as classes taking the same test or participants in an experiment—simply looking at averages does not always reveal the whole story. Comparing data distributions allows you to see differences in spread, outliers, and overall patterns. In educational settings, visualizing the test scores from two classes side by side can help identify which class has more consistent results, whether one group has higher outliers, or if both groups share a similar range of scores. Boxplots are a powerful way to summarize and compare these distributions, as they highlight the median, quartiles, and any potential outliers in a compact visual format.

123456789101112131415161718
import random import seaborn as sns import matplotlib.pyplot as plt # Generate random test scores for two classes class_a_scores = [random.randint(60, 100) for _ in range(30)] class_b_scores = [random.randint(55, 98) for _ in range(30)] # Prepare data for seaborn data = [class_a_scores, class_b_scores] labels = ["Class A", "Class B"] # Create side-by-side boxplots sns.boxplot(data=data) plt.xticks([0, 1], labels) plt.ylabel("Test Scores") plt.title("Comparison of Test Score Distributions: Class A vs Class B") plt.show()
copy
Завдання

Swipe to start coding

Write a function that generates two lists of random integers to represent test scores for two different classes. Use seaborn to create side-by-side boxplots comparing the score distributions. Add descriptive labels for the x-axis, y-axis, and a title for the plot.

  • Generate a list of 30 random integers between 60 and 100 for the first class.
  • Generate a list of 30 random integers between 55 and 98 for the second class.
  • Create a side-by-side boxplot comparing the two lists.
  • Label the x-axis with the class names, set a label for the y-axis, and add a plot title.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 7
single

single

some-alt