나는 27 개의 열이있는 Excel 파일이 있습니다. 파이썬 코드를 작성하여 칼럼별로 열을 읽고 coloum에 마지막 5 개의 값을 저장합니다. 칼럼에 수학 방정식이 저장됩니다.열을 읽고 Excel에서 특정 수학을 수행
지금까지이있다 :
from math import tan
#Write Header
#outFile.write('Test Name,X+ avg,X+ std,X+ count,X- avg,X- std,X- count,X angle,Y+ avg,Y+ std,Y+ count,Y- avg,Y- std,Y- count,Y angle\n')
#for line in inFile:
if 1==1:
line = [1,2,38.702,37.867,35.821, 44, 49,55,65,20,25,28,89.]
line0= len(line)
print "the list size"
print line0
line1 = len(line) -5 #takes the overall line and subtracts 5.
print "the is the start of the 5 #'s we need"
print line1 #prints the line
d= line[line1:line0] #pops all the values from in the line (..)
print "these are the 5 #'s we need"
print d
lo=min(d)
hi=max(d)
print "the lowest value is"
print lo
print "the highest value is"
print hi
average1 = float (sum(d))/ len(d) #sum
print "the average of the values is"
print average1
은 "광고 =. 1,2,38.702,37.867,35.821, 44, 49,55,65,20,25,28,89]" 내가 파이썬이 coloumn에서 자동으로 읽고, 마지막 5 개의 값을 저장하고 위의 수학 분석을 수행하기를 원합니다.
'line'이라는 목록의 마지막 다섯 항목에 대해'line [-5 :]'를 수행하십시오. 자,이 Excel 파일은 진정한 Excel 파일입니까 아니면 CSV입니까? Excel 인 경우 .xls 또는 .xlsx입니까? Excel 파일을 여는 것이 문제입니까, 아니면 행에서 마지막 5 개의 값을 추출하는 것이 문제입니까? –
글쎄, 파이썬은 열을 검색하고 마지막 5자를 저장하고이 수학을 적용하기를 원합니다. 내가 말했듯이, "line = [1,2,38.702,37.867,35.821, 44, 49,55,65,20,25,28,89]"방금 내 방정식이 작동하는 것을 보았습니다. 덕분에 – user1778360