0% found this document useful (0 votes)
6 views1 page

Extra Documents For Ai

The document contains Python code for statistical analysis and data visualization. It calculates mean, median, mode, standard deviation, and variance of ages, and generates scatter plots for vehicles vs pollution, bar charts for expenses by category, and histograms for customer waiting times. The outputs include statistical values and graphical representations of the data.

Uploaded by

sanskar80024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Extra Documents For Ai

The document contains Python code for statistical analysis and data visualization. It calculates mean, median, mode, standard deviation, and variance of ages, and generates scatter plots for vehicles vs pollution, bar charts for expenses by category, and histograms for customer waiting times. The outputs include statistical values and graphical representations of the data.

Uploaded by

sanskar80024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

ages-----statistics(mean;median;modee)

INPUT
import statistics
ages=[25,30,35,40,45,50,55,60,65,70]

mean=statistics.mean(ages)
median=statistics.median(ages)
mode=statistics.mode(ages)
std_dev=statistics.stdev(ages)
variance=statistics.variance(ages)
print("mean:",mean)
print("median:",median)
print("mode:",mode)
print("standard deviation:",round(std_dev,2))
print("variance:",round(variance,2))
OUTPUT
mean: 47.5
median: 47.5
mode: 25
standard deviation: 15.14
variance: 229.17

SCATTER PLOTS----- VEHICLES VS POLLUTION


INPUT
import matplotlib.pyplot as plt
vehicles=[10,20,25,40,50,60,75,80,85,90]
pollution=[30,20,90,96,100,300,375,400,405,500]
plt.scatter(vehicles,pollution,color='blue',marker='s')
plt.xlabel('number of vehicles on road')
plt.ylabel('air pollution level(AQI)')
plt.title('number of vehicles vs air pollution')
plt.show\
OUTUT(GRAPH)

BAR CHART---CATEGORIES;EXPENSES
IMPORT
import matplotlib.pyplot as plt
categories=["groceries","utilities","rent","entertainment"]
expenses=[500,200,1000,300]
plt.bar(categories,expenses,color='purple')
plt.xlabel("expense categories")
plt.ylabel("monthly expenses(in USD)")
plt.title("monthly ecpenses by category")
plt.show()
OUTPUTGRAPH)

customer waiting(joint bar)(bins)


INPUT
import matplotlib.pyplot as plt
waiting_times=[5,6,1,11,22,23,6,23,16,17,14,15,23,18,19]
bins=[5,10,15,20,25]
plt.hist(waiting_times, bins=bins, color='m')
plt.xlabel('minutes')
plt.ylabel('frequency')
plt.title('customer waiting time histogram')
plt.show()
OUTPUT

You might also like