Question 1209397: Stories in the World's Tallest Buildings The number of stories in each of a sample of the world's 25 tallest buildings follows. Construct a grouped frequency distribution and a cumulative frequency distribution with 8 classes. 90 69 64 79 77 88 56 70 60 55 55 71 70 100 75 80 88 72 75 78 85 60 65 88 80
Found 2 solutions by ElectricPavlov, ikleyn: Answer by ElectricPavlov(122) (Show Source):
You can put this solution on YOUR website! I'll start by sorting the data and determining the number of classes, the class interval, and the class limits, and then I'll construct a grouped frequency distribution and a cumulative frequency distribution.
```python?code_reference&code_event_index=3
import pandas as pd
# Create a list named `num_stories`
num_stories = [90, 69, 64, 79, 77, 88, 56, 70, 60, 55, 55, 71, 70, 100, 88, 88, 80, 75, 60, 75, 88, 102, 78, 70, 72]
# Sort the data in ascending order
num_stories.sort()
# Determine the number of classes
num_classes = 8
# Calculate the class interval
range_data = max(num_stories) - min(num_stories)
class_interval = int(range_data / num_classes) + 1 # Round up for safety
# Determine class limits
lower_limit = min(num_stories)
class_limits = []
for _ in range(num_classes):
upper_limit = lower_limit + class_interval - 1
class_limits.append((lower_limit, upper_limit))
lower_limit = upper_limit + 1
# Construct grouped frequency distribution
frequency_distribution = {}
for lower, upper in class_limits:
frequency_distribution[(lower, upper)] = 0
for stories in num_stories:
if lower <= stories <= upper:
frequency_distribution[(lower, upper)] += 1
# Construct cumulative frequency distribution
cumulative_frequency = 0
cumulative_distribution = {}
for lower, upper in class_limits:
cumulative_frequency += frequency_distribution[(lower, upper)]
cumulative_distribution[(lower, upper)] = cumulative_frequency
# Display the distributions
print("Grouped Frequency Distribution:")
for (lower, upper), frequency in frequency_distribution.items():
print(f"{lower}-{upper}: {frequency}")
print("\nCumulative Frequency Distribution:")
for (lower, upper), frequency in cumulative_distribution.items():
print(f"{lower}-{upper}: {frequency}")
```
```text?code_stdout&code_event_index=3
Grouped Frequency Distribution:
55-60: 5
61-66: 1
67-72: 6
73-78: 4
79-84: 2
85-90: 5
91-96: 0
97-102: 2
Cumulative Frequency Distribution:
55-60: 5
61-66: 6
67-72: 12
73-78: 16
79-84: 18
85-90: 23
91-96: 23
97-102: 25
```
The grouped frequency distribution and cumulative frequency distribution tables are:
**Grouped Frequency Distribution**
| Stories | Frequency |
|---|---|
| 55 - 60 | 5 |
| 61 - 66 | 1 |
| 67 - 72 | 6 |
| 73 - 78 | 4 |
| 79 - 84 | 2 |
| 85 - 90 | 5 |
| 91 - 96 | 0 |
| 97 - 102 | 2 |
**Cumulative Frequency Distribution**
| Stories | Cumulative Frequency |
|---|---|
| 55 - 60 | 5 |
| 61 - 66 | 6 |
| 67 - 72 | 12 |
| 73 - 78 | 16 |
| 79 - 84 | 18 |
| 85 - 90 | 23 |
| 91 - 96 | 23 |
| 97 - 102 | 25 |
Answer by ikleyn(52803) (Show Source):
|
|
|