32 lines
911 B
Python
Executable File
32 lines
911 B
Python
Executable File
def fileread(x):
|
|
"""
|
|
Andrew Noah Woodlee
|
|
Assignment: fileread
|
|
ENG 101-06
|
|
Due Date: 11-12-19
|
|
Reads from x and
|
|
"""
|
|
import statistics as stats
|
|
import csv as c
|
|
Data=[]
|
|
uinput=input("Does the file have column header information (y/n)? ")
|
|
with open(x,newline='') as In_f:
|
|
FileData=c.reader(In_f,delimiter=',')
|
|
if uinput=="y":
|
|
Header=True
|
|
elif uinput=='n':
|
|
Header=False
|
|
for column in FileData:
|
|
if Header:
|
|
Header=False
|
|
HeaderInfo=column
|
|
else:
|
|
Data.append(float(column(1)))
|
|
a=len(Data)
|
|
b=stats.mean(Data)
|
|
c=min(Data)
|
|
ma=max(Data)
|
|
standdev=stats.stdev(Data)
|
|
print(x,'Column 2 has a minimum of ',c,' and a maximum of ',ma)
|
|
print(x,'Column 2 has a mean of ',b, ' with ',a,' data points')
|
|
print(x,'Column 2 standard deviation is ', standdev) |