python excel处理openpyxl

#!usr/bin/dev python
#utf-8

from openpyxl import load_workbook
import os
import os.path
file_path = 'C:/Users/Hugo Lester/Desktop/statics.xlsx'
ws = load_workbook(file_path)
sheet = ws.get_sheet_by_name('Sheet1')
for i in range(1,10):
clo = str(int(i))

#sheet['G'+clo] = sheet.cell['A'+clo].value +sheet.cell['B'+clo].value+sheet.cell['C'+clo].value+sheet.cell['D'+clo].value+sheet.cell['E'+clo].value+sheet.cell['F'+clo].value
#+ sheet['B'+clo]+ sheet['C'+clo]+ sheet['D'+clo]+ sheet['E'+clo]+ sheet['F'+clo]
#sheet['A' + clo].value + sheet['B' + clo].value + sheet['C' + clo].value +sheet['D'+clo].value+sheet['E'+clo].value+sheet['F'+clo].value
sheet['G' + clo] = 0
for row in range(0,6):
rownum = chr(ord('A')+ row)
position = rownum + clo
print sheet[position].value
#print rownum
if not sheet[position].value is None:

sheet['G' + clo] = sheet['G' + clo].value +sheet[position].value
#print rownum
#print type(row)
#print type(sheet['G' + clo].value)
#print rownum
ws.save(file_path)

  

#!/usr/bin/python
#coding: utf-8

import numpy as np  
import matplotlib.pyplot as plt  
    
x = np.arange(-1,1,0.02)  
y = 2*np.sin(x*2.3)+0.5*x**3

y1 = y+0.5*(np.random.rand(len(x))-0.5)


##################################
# 写下你的Code




##################################
plt.plot(x,y,color='g',linestyle='-',marker='') 
plt.plot(x,y1,color='m',linestyle='',marker='o')

# 把拟合的曲线在这里画出来

plt.show()

  

你可能感兴趣的:(python excel处理openpyxl)