摘要: 1 import pandas 2 excel=pandas.read_excel('现代征信学.xlsx',index_col='列名',header=None) #header默认为0,指读取第几行,0代表第一行 3 excel.columns=['Id','title','hh','uei', 阅读全文
posted @ 2020-06-06 20:56 misherry 阅读(314) 评论(0) 推荐(0)
摘要: 1 import pandas 2 a=pandas.DataFrame({'ID':[1,2,3],'Name':['Time','Mike','Nick']}) 3 b=a.set_index('ID') #重新设置索引 4 b.to_excel(r'D:\计算机二级\ocr 训练\a.xlsx 阅读全文
posted @ 2020-06-06 20:27 misherry 阅读(959) 评论(0) 推荐(0)
摘要: 1 from matplotlib import pyplot 2 import numpy 3 x=numpy.random.randn(100) #生成100个随机数,关于标准正态分布 4 y=-x+numpy.random.randn(100)*0.5 5 pyplot.scatter(x,y 阅读全文
posted @ 2020-06-06 19:52 misherry 阅读(232) 评论(0) 推荐(0)
摘要: from pptx import Presentation prs=Presentation('名字.pptx') for slide in prs.slides: # 读取每一页幻灯片 for shape in slide.shapes: #获取每一页的内容 if shape.has_text_f 阅读全文
posted @ 2020-06-05 22:32 misherry 阅读(269) 评论(0) 推荐(0)
摘要: import pdfplumber pdf=pdfplumber.open(',,,,,,,.pdf') first_page=pdf.pages[0] print(first_page.extract_text()) #打印第一页内容 #提取其中的表格 first_page.extract_tab 阅读全文
posted @ 2020-06-05 22:19 misherry 阅读(947) 评论(0) 推荐(0)
摘要: 1 from docx import Document 2 3 word=Document() 4 5 word.add_heading('一级标题',level=1) #增加一级标题 6 7 p1=word.add_paragraph('这是第一段') 8 9 p2=word.add_paragr 阅读全文
posted @ 2020-06-05 21:51 misherry 阅读(470) 评论(0) 推荐(0)
摘要: 1 from docx import Document 2 3 word=Document(',,,,,,.docx') 4 5 paragraphs=word.paragraphs #返回一个列表,有多少段就有多少个值 6 7 for i in paragraphs: 8 9 print(i.te 阅读全文
posted @ 2020-06-05 21:42 misherry 阅读(299) 评论(0) 推荐(0)
摘要: 1 from docx import Document 2 3 word =Document(r'表格名称.docx') 4 5 #读取表格 6 7 tables=word.tables 8 9 for i in tables[:]: 10 11 for j,row in enumerate(i.r 阅读全文
posted @ 2020-06-05 21:23 misherry 阅读(428) 评论(0) 推荐(0)
摘要: 1 from PIL import Image,ImageFont,ImageDraw,ImageFilter 2 import random 3 import string 4 import sys 5 import math 6 7 numbers=4 8 size=(150,60) 9 bgc 阅读全文
posted @ 2020-06-04 17:08 misherry 阅读(230) 评论(0) 推荐(0)
摘要: -- 创建数据库 create database 数据库名 default charset =utf8; -- 创建表 create table 表名 ( id int,name char(20)); create table 表名 (id int null/not null,name char(2 阅读全文
posted @ 2020-06-03 18:05 misherry 阅读(156) 评论(0) 推荐(0)