python_operation on excel

====This my mood now====

I recently solve the problem of Excel ‘ data , it is hard to process Excel data because of huge amount of it.However, there is a better tool to process–Python.I simply write 34 lines to operation on Excel’s data to count th number of the key word.

Just for recording.

code

import xlrd
import xlwt
import re
import numpy as np
import pandas as pd

#import openpyxl


data = xlrd.open_workbook('C:\Users\hp\Desktop\数据信息3.xlsx')

table = data.sheets()[0]

ncols = table.col_values(12)
a = len(ncols)
pattern = re.compile(r'd+')
d=[]
for i in range(1,a):
    #print(pattern.findall(ncols[i]))
   # print("n")
    b = len(pattern.findall(ncols[i]))
    c=[]
    for j in range(0,b):
        if eval(pattern.findall(ncols[i])[j] )< 10 :
            c.append(pattern.findall(ncols[i])[j])
    #print(c)
    d.append(len(c))
    #print(d)
    f = xlwt.Workbook()               #创建工作簿
sheet1 = f.add_sheet(u'sheet1',cell_overwrite_ok=True) #创建sheet
for i in range(0,len(d)):
    sheet1.write(i+1,0,d[i])
f.save("C:\Users\hp\Desktop\2.xls")
print("结束")