Question
Python Programming Mean and standard deviation. You are given a csv file that has 3 numbers per line, separated by commas. Write a program to
Python Programming
Mean and standard deviation.
You are given a csv file that has 3 numbers per line, separated by commas. Write a program to calculate the mean and standard deviation of each column of the file, using the formula:
where sigma is the standard deviation, xbar is the mean of the data set, N is the number of elements in the dataset, and xi is an element of the dataset at spot i.
You will need:
a. open the file.
b. initialize 3 list accumulators
c. iterate over the lines of the file in a for loop and accumulate the values in the columns
d. compute the aerage
e. when you have the mean xbar, calculate the standard deviation using a second for loop.
The output should look like:
The mean of column 1 is ____ and the standard deviation is ____
The mean of column 2 is ____, and the standard deviation is ____
The mean of column 3 is ____, and the standard deviation is____
(Obviously no numbers have been calculated, but when they are they should appear in the output. I have the csv file and cannot upload it, so the context of the code should call on an arbitrary csv file, and my code will call on mine.
= .,(2, - ) 2) -1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started