1
0
UAHCode/ENG101/fileread.py

32 lines
911 B
Python
Raw Permalink Normal View History

2022-08-28 19:39:08 +00:00
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)