06 2020 档案

摘要:import pandas a=pandas.DataFrame({'Country': ['China,US', 'Japan,EU', 'UK,Australia', 'Singapore,Netherland'], 'Number': [100, 150, 120, 90], 'Value': 阅读全文
posted @ 2020-06-28 18:24 马蹄哒哒 阅读(356) 评论(0) 推荐(0)
摘要:import pandas a=pandas.read_excel(r'D:\scrapy网络爬虫\nba.xlsx') bins=[0,5000000,max(a['Salary'])] group_by=['底','高'] a['new_col']=pandas.cut(a['Salary'], 阅读全文
posted @ 2020-06-28 14:36 马蹄哒哒 阅读(298) 评论(0) 推荐(0)
摘要:import pandas a=pandas.read_excel() def abc(x): return ','.join(x.values) b=a.groupby(['列名'1])['列名2'].apply(abc) c=b.reset_index() print(c) 阅读全文
posted @ 2020-06-27 22:00 马蹄哒哒 阅读(603) 评论(0) 推荐(0)
摘要:a=['序号',1,2,3,4,5] b=['成本',20,45,12,34,67] import pandas c=pandas.Series(a) d=pandas.Series(b) e=pandas.DataFrame(list(zip(c,d))) print(e) 0 1 0 序号 成本 阅读全文
posted @ 2020-06-26 16:52 马蹄哒哒 阅读(2821) 评论(0) 推荐(0)
摘要:from boss.items import BossItem class ZhiPinSpider(CrwalSpider): name='Zhipin' allwed_domains=['zhipin.com'] start_urls=['https://www.zhipin.com/c1000 阅读全文
posted @ 2020-06-24 14:06 马蹄哒哒 阅读(415) 评论(1) 推荐(0)
摘要:from scrapy.exporters import JsonLinesItemExporter class BossPipleline(object): def __init__(self): self.fp=open('jobs.json','wb') self.exporter=JsonL 阅读全文
posted @ 2020-06-24 13:50 马蹄哒哒 阅读(283) 评论(0) 推荐(0)
摘要:import random import base64 #方法一 #设置代理ip class IpProxyDownLoadMiddleWares(object): Proxys=['178.44.170.152:8080','110.44.113.182:8080','209.126.124.73 阅读全文
posted @ 2020-06-24 12:45 马蹄哒哒 阅读(355) 评论(0) 推荐(0)
摘要:import requests import time from lxml import etree import json #获取网页函数 def getpage(url): try: headers={'User-Agent':'Mozilla/5.0 (Linux; Android 6.0; 阅读全文
posted @ 2020-06-23 21:45 马蹄哒哒 阅读(160) 评论(0) 推荐(0)
摘要:import numpy from matplotlib import pyplot from matplotlib import animation def update_points(num): point_ani.set_data(x[num],y[num]) #更新点的位置,将这里的(x[n 阅读全文
posted @ 2020-06-23 17:55 马蹄哒哒 阅读(706) 评论(0) 推荐(0)
摘要:import time from concurrent.futures import ThreadPoolExecutor import threading import os def work(n): print(f'给{n}打电话,进程号是:{os.getpid},线程号是:{threading 阅读全文
posted @ 2020-06-23 11:37 马蹄哒哒 阅读(207) 评论(0) 推荐(0)
摘要:import requestshtml=requests.get('url')soup=BeautifulSoup(html.text,'lxml') 解析器的种类: html.parser: python自带,但容错性不够高 lxml: 解析速度快,需额外安装(推荐使用) xml: 同lxml库, 阅读全文
posted @ 2020-06-22 17:18 马蹄哒哒 阅读(1017) 评论(0) 推荐(0)
摘要:import os import pymysql from fnmatch import fnmatch aaa=input(r'请输入存放作业的绝对路径:') filename=os.listdir(aaa) #获取绝对路径 import pymysql import pandas db=pymy 阅读全文
posted @ 2020-06-21 21:09 马蹄哒哒 阅读(125) 评论(0) 推荐(0)
摘要:import requests #需要请求的目标地址 url='http://www.rrys2019.com/user/user' headers={'user-agent':'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) Apple 阅读全文
posted @ 2020-06-21 16:46 马蹄哒哒 阅读(346) 评论(0) 推荐(0)
摘要:import requests url='https://fanyi.baidu.com/sug' headers={'user-agent':'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KH 阅读全文
posted @ 2020-06-21 15:47 马蹄哒哒 阅读(249) 评论(0) 推荐(0)
摘要:from matplotlib import pyplot import numpy def f(x,y): return (1-x/2+x**5)*numpy.exp(-x**2-y**2) n=256 x=numpy.linspace(-3,3,n) y=numpy.linspace(-3,3, 阅读全文
posted @ 2020-06-20 21:39 马蹄哒哒 阅读(141) 评论(0) 推荐(0)
摘要:import numpy from matplotlib import pyplot n=12 x=numpy.arange(12) y1=(1-x/float(n))*numpy.random.uniform(0.5,1.0,n) y2=(1-x/float(n))*numpy.random.un 阅读全文
posted @ 2020-06-20 21:21 马蹄哒哒 阅读(118) 评论(0) 推荐(0)
摘要:(一) 加减法 import numpy a=numpy.arange(27).reshape(3,9) b=numpy.arange(2,29).reshape(3,9) #加: c=a+b d=numpy.add(a,b) #减: e=a-b f=numpy.subtract(a,b) (二)乘 阅读全文
posted @ 2020-06-20 13:24 马蹄哒哒 阅读(970) 评论(0) 推荐(0)
摘要:import pickle d1={'a':234,'b':[3,5,7],'w':[4,5]} #存储数据 f=open(r'D:\matplotlib绘图\aaa.pickle','wb') pickle.dump(d1,f) f.close() #读取数据 with open(r'D:\mat 阅读全文
posted @ 2020-06-19 21:08 马蹄哒哒 阅读(1681) 评论(0) 推荐(0)
摘要:Python 正则 什么是正则# 正则表达式是对字符串(包括普通字符(例如,a 到 z 之间的字母)和特殊字符(称为元字符))操作的一种逻辑公式,就是用事先定义好的一些特定字符、及这些特定字符的组合,组成一个规则字符串,这个规则字符串用来表达对字符串的一种过滤逻辑。正则表达式是一种文本模式,该模式描 阅读全文
posted @ 2020-06-19 16:31 马蹄哒哒 阅读(321) 评论(0) 推荐(0)
摘要:from matplotlib import pyplot import numpy n=1024 x=numpy.random.normal(0,1,1024) y=numpy.random.normal(0,1,1024) t=numpy.arctan2(x,y) #代表颜色的数量值 #pypl 阅读全文
posted @ 2020-06-19 11:45 马蹄哒哒 阅读(235) 评论(0) 推荐(0)
摘要:import numpy from matplotlib import pyplot x=numpy.linspace(-3,3,50) y=2*x+1 pyplot.figure(num=1,figsize=(5,5)) pyplot.plot(x,y,linewidth=10,zorder=1) 阅读全文
posted @ 2020-06-19 11:35 马蹄哒哒 阅读(167) 评论(0) 推荐(0)
摘要:import numpy a=numpy.arange(1,25).reshape(8,3) #对二维进行数组转置 b=numpy.transpose(a) c=a.transpose() d=a.T #print(d) print('对于三维a[i][j][k]进行转置,默认的将i和k交换,j位置 阅读全文
posted @ 2020-06-19 11:20 马蹄哒哒 阅读(794) 评论(0) 推荐(0)
摘要:import numpy x=numpy.arange(9) array([0, 1, 2, 3, 4, 5, 6, 7, 8]) #对一维数组进行分隔 a=numpy.split(x,3) #将数组平均分成3份 #传递数组按位置进行分隔 b=numpy.split(x,[3,5]) print(a 阅读全文
posted @ 2020-06-19 11:04 马蹄哒哒 阅读(371) 评论(0) 推荐(0)
摘要:import numpy from matplotlib import pyplot x=numpy.linspace(-3,3,50) y=2*x+1 pyplot.figure(num=1,figsize=(5,5)) pyplot.plot(x,y) ax=pyplot.gca() ax.sp 阅读全文
posted @ 2020-06-18 19:32 马蹄哒哒 阅读(352) 评论(0) 推荐(0)
摘要:pyplot.rcParams['font.sans-serif']=['simhei'] #显示中文标签 pyplot.rcParams['axes.unicode_minus']=False 阅读全文
posted @ 2020-06-18 13:23 马蹄哒哒 阅读(223) 评论(0) 推荐(0)
摘要:import numpy from matplotlib import pyplot x=numpy.linspace(-3,3,50) y1=2*x+1 y2=x**2 pyplot.rcParams['font.sans-serif']=['simhei'] #显示中文标签 pyplot.rcP 阅读全文
posted @ 2020-06-18 13:21 马蹄哒哒 阅读(288) 评论(0) 推荐(0)
摘要:import numpy #创建数组 a=numpy.array([[1,2,3],[4,5,6]]) b=numpy.array([[11,34,56],[4,6,78]]) #使用hstack进行水平拼接 r=numpy.hstack([a,b]) #也可以使用()把a,b括起来 #使用vsta 阅读全文
posted @ 2020-06-18 11:52 马蹄哒哒 阅读(668) 评论(0) 推荐(0)
摘要:import numpy a=numpy.arange(27).reshape(3,3,3) b=numpy.arange(12) c=numpy.reshape(b,(2,3,2)) #修改为三维数组 #将多维数组修改为一维数组 d=c.reshape(12) e=c.reshape(-1) #通 阅读全文
posted @ 2020-06-18 10:57 马蹄哒哒 阅读(405) 评论(0) 推荐(0)
摘要:1 import numpy 2 from matplotlib import pyplot 3 x=numpy.linspace(-3,3,50) 4 y1=2*x+1 5 y2=x**2 6 7 8 pyplot.figure(num='第一幅图',figsize=(5,5)) 9 pyplot 阅读全文
posted @ 2020-06-17 14:21 马蹄哒哒 阅读(436) 评论(0) 推荐(0)
摘要:import numpy from matplotlib import pyplot x=numpy.linspace(-3,3,50) y1=2*x+1 y2=x**2 #创建第一个画布 pyplot.figure() pyplot.plot(x,y1) #创减第二个画布 pyplot.figur 阅读全文
posted @ 2020-06-17 13:47 马蹄哒哒 阅读(221) 评论(0) 推荐(0)
摘要:import numpy a=numpy.arange(12).reshape(3,4) b=a[:2,:2] #对子数组b中值进行修改,将会影响到a数组中的值 b[0][1]=1000 print(a) [[ 0 1000 2 3] [ 4 5 6 7] [ 8 9 10 11]] print(b 阅读全文
posted @ 2020-06-17 10:54 马蹄哒哒 阅读(172) 评论(0) 推荐(0)
摘要:import numpy x=numpy.arange(1,13) a=x.reshape(4,3) #二维数组 #索引的使用 b=a[2] #获取第二行 c=a[2][2] #获取第二行的第三列 #切片的使用 d=a[:,:] #获取所有行与列 e=a[:,1] #获取所以行第二列的数据 f=a[ 阅读全文
posted @ 2020-06-17 10:43 马蹄哒哒 阅读(976) 评论(0) 推荐(0)
摘要:import numpy a=numpy.arange(10) #索引访问,和字符串索引一样 print(a[-3]) print(a[2]) #切片访问 print(a[:]) print(a[3:4]) print(a[1:7:2]) print(a[::-1]) 阅读全文
posted @ 2020-06-17 10:21 马蹄哒哒 阅读(403) 评论(0) 推荐(0)
摘要:isdecimal():判断给定字符串是否全为数字 isalpha():判断给定的字符串是否全为字母 isalnum():判断给定的字符串是否只含有数字与字母 isupper():判断给定的字符串是否全为大写 islower():判断给定的字符串是否全为小写 istitle():判断给定的字符串是否 阅读全文
posted @ 2020-06-16 18:32 马蹄哒哒 阅读(366) 评论(0) 推荐(0)
摘要:import numpy #zeros方法 a=numpy.zeros((5),dtype=int) b=numpy.zeros((3,4)) #ones方法 c=numpy.ones((10,4),dtype=int) #empty方法 #一维数组 empty=numpy.empty(8) #二维 阅读全文
posted @ 2020-06-16 10:39 马蹄哒哒 阅读(279) 评论(2) 推荐(0)
摘要:import numpy #创建一位数组 a=numpy.array([1,2,3,4]) b=numpy.arange(4,10) #创建三维数组 c=numpy.random.randint(4,10,size=(3,3,4)) #ndarray属性 print(c.ndim) # 返回维度 # 阅读全文
posted @ 2020-06-16 09:49 马蹄哒哒 阅读(459) 评论(0) 推荐(0)
摘要:import numpy #生成随机5个0-1之间元素的以为数组 a=numpy.random.random(size=5) #创建随机二维数组 b=numpy.random.random(size=(3,4)) #创建随机三维数组(包括0,不包括1) c=numpy.random.random(s 阅读全文
posted @ 2020-06-16 09:31 马蹄哒哒 阅读(930) 评论(0) 推荐(0)
摘要:import numpy a=numpy.arange(1,10,2,dtype=float) #1指初值,2值终值,2指步长 b=numpy.sqrt(a) #对a数组里面的每个元素进行开平方 阅读全文
posted @ 2020-06-15 21:47 马蹄哒哒 阅读(483) 评论(0) 推荐(0)
摘要:import pandas import numpy def get_circle_area(l,h): r=numpy.sqrt(l**2+h**2)/2 return r**2*numpy.pi excel=pandas.read_excel('长方形.xlsx',index_col='id') 阅读全文
posted @ 2020-06-15 11:36 马蹄哒哒 阅读(669) 评论(0) 推荐(0)
摘要:1 import pymysql 2 import pandas 3 db=pymysql.connect(host='localhost',port=3306,user='root',database='lihao',password='lh19990317') 4 #cursor=db.curs 阅读全文
posted @ 2020-06-15 11:20 马蹄哒哒 阅读(192) 评论(0) 推荐(0)
摘要:import pandas import numpy page1=pandas.read_excel('成绩.xlsx',sheet_name='Sheet1') page2=pandas.read_excel('成绩.xlsx',sheet_name='Sheet2') page1.columns 阅读全文
posted @ 2020-06-15 09:45 马蹄哒哒 阅读(424) 评论(0) 推荐(0)
摘要:Counter类: Counter类的目的是用来跟踪值出现的次数。它是一个无序的容器类型,以字典的键值对形式存储,其中元素作为key,其计数作为value。计数值可以是任意的Interger(包括0和负数)。Counter类和其他语言的bags或multisets很相似。 (一)创建Counter类 阅读全文
posted @ 2020-06-14 22:39 马蹄哒哒 阅读(4699) 评论(0) 推荐(0)
摘要:import pandas sheet1=pandas.read_excel('成绩.xlsx',sheet_name='Sheet1') sheet2=pandas.read_excel('成绩.xlsx',sheet_name='Sheet2') 连接两张表 students=sheet1.ap 阅读全文
posted @ 2020-06-14 17:57 马蹄哒哒 阅读(333) 评论(0) 推荐(0)
摘要:1 import pandas 2 from matplotlib import pyplot 3 from scipy.stats import linregress 4 sale=pandas.read_excel('销售.xlsx',dtype={'date':str}) 5 6 7 slop 阅读全文
posted @ 2020-06-14 11:24 马蹄哒哒 阅读(390) 评论(0) 推荐(0)
摘要:1 import pandas 2 import numpy 3 csv=pandas.read_csv('salesmen.csv') 4 csv['Month']=pandas.DatetimeIndex(csv['Date']).month 5 6 #透视表制作方法一: 7 #pt=csv.p 阅读全文
posted @ 2020-06-13 13:14 马蹄哒哒 阅读(313) 评论(3) 推荐(0)
摘要:1 import pandas 2 csv=pandas.read_csv('salesmen.csv') 3 tsv=pandas.read_csv('a.tsv',sep='\t') #sep代表制表符的种类 4 txt=pandas.read_csv('b.txt',sep='-') 5 pr 阅读全文
posted @ 2020-06-13 12:28 马蹄哒哒 阅读(369) 评论(0) 推荐(0)
摘要:1 import pandas 2 pandas.options.display.max_columns=20 #显示所有的列名 3 excel=pandas.read_excel('成绩.xlsx',index_col='id') 4 table=excel.transpose() #旋转表 5 阅读全文
posted @ 2020-06-13 11:38 马蹄哒哒 阅读(211) 评论(0) 推荐(0)
摘要:1 import pandas 2 excel=pandas.read_excel('成绩.xlsx',sheet_name='Sheet1') 3 #excel.drop_duplicates(subset='name',inplace=True,keep='last') #keep默认为Firs 阅读全文
posted @ 2020-06-13 11:32 马蹄哒哒 阅读(209) 评论(0) 推荐(0)
摘要:1 import pandas 2 excel=pandas.read_excel(r'F:\pandas练习\成绩.xlsx',index_col='id',sheet_name='Sheet1') 3 temp=excel[['score1','score2']] 4 5 row_sum=tem 阅读全文
posted @ 2020-06-12 13:43 马蹄哒哒 阅读(241) 评论(0) 推荐(0)
摘要:1 import pandas 2 excel=pandas.read_excel('name.xlsx') 3 4 #这里的n是指保留前几列,默认为0或者1,意思是全部保留,expand指是否扩展,默认为False 5 d=excel['name'].str.split(n=0,expand=Tr 阅读全文
posted @ 2020-06-12 12:19 马蹄哒哒 阅读(358) 评论(0) 推荐(0)
摘要:1 import pandas 2 3 #定义数据效验函数 4 def score_validation(row): 5 try: 6 assert 0<=row['score']<=100 7 except: 8 print(row['sid'],row['name'],row['score']) 阅读全文
posted @ 2020-06-12 12:18 马蹄哒哒 阅读(169) 评论(0) 推荐(0)
摘要:(一)merge 1 merge(left, right, how='inner', on=None, left_on=None, right_on=None, 2 left_index=False, right_index=False, sort=True, 3 suffixes=('_x', ' 阅读全文
posted @ 2020-06-11 21:24 马蹄哒哒 阅读(415) 评论(0) 推荐(0)
摘要:1 import pandas 2 from matplotlib import pyplot 3 4 pandas.options.display.max_columns=10 #最多显示多少列 5 6 excel=pandas.read_excel('revenue.xlsx') 7 8 pri 阅读全文
posted @ 2020-06-11 16:40 马蹄哒哒 阅读(136) 评论(0) 推荐(0)
摘要:1 import pandas 2 from matplotlib import pyplot 3 4 pandas.options.display.max_columns=10 #最多显示多少列 5 6 excel=pandas.read_excel('revenue.xlsx') 7 8 9 # 阅读全文
posted @ 2020-06-11 16:35 马蹄哒哒 阅读(358) 评论(0) 推荐(0)
摘要:1 import pandas 2 from matplotlib import pyplot 3 4 pandas.options.display.max_columns=10 #最多显示多少列 5 6 excel=pandas.read_excel('revenue.xlsx') 7 8 9 # 阅读全文
posted @ 2020-06-11 16:33 马蹄哒哒 阅读(138) 评论(0) 推荐(0)
摘要:1 import pandas 2 from matplotlib import pyplot 3 4 pandas.options.display.max_columns=10 #最多显示多少列 5 6 excel=pandas.read_excel('revenue.xlsx') 7 print 阅读全文
posted @ 2020-06-11 15:14 马蹄哒哒 阅读(162) 评论(0) 推荐(0)
摘要:MySQL数据库中提供了很丰富的函数。MySQL函数包括数学函数、字符串函数、日期和时间函数、条件判断函数、系统信息函数、加密函数、格式化函数等。通过这些函数,可以简化用户的操作。例如,字符串连接函数可以很方便的将多个字符串连接在一起。在这一讲中将讲解的内容包括:数学函数字符串函数日期和时间函数条件 阅读全文
posted @ 2020-06-10 21:36 马蹄哒哒 阅读(160) 评论(0) 推荐(0)
摘要:--创建触发器 delimiter //create trigger 触发器名 before(after) insert(update,delete) on t1 for each rowbegindeclare a varchar(20);declare b varchar(20);set a=( 阅读全文
posted @ 2020-06-10 21:33 马蹄哒哒 阅读(142) 评论(0) 推荐(0)
摘要:--创建视图(视图是虚拟存在的,不能向其中插入数据) create view 视图名 as select * from student; --修改视图 alter view 视图名 as sql语句; 阅读全文
posted @ 2020-06-10 21:09 马蹄哒哒 阅读(108) 评论(0) 推荐(0)
摘要:select * from 表名; select id,name as t(name这一列的新列名) from t1 where id>10 or name='王五'; select name,age,1 from t; select * from t where id in (1,5,12); s 阅读全文
posted @ 2020-06-10 20:59 马蹄哒哒 阅读(259) 评论(0) 推荐(0)
摘要:create table t1( id int, num1 int, num2 int, unique up (num1) /unique up (num1,num2) )engine=innodb default charset=utf8; 阅读全文
posted @ 2020-06-10 18:29 马蹄哒哒 阅读(403) 评论(0) 推荐(0)
摘要:--设置局部自增步长 set session auto_increment_increment=2; --设置全局自增步长 set global auto_increment_increment=2; --查看局部步长 show session variables like 'auto_inc%'; 阅读全文
posted @ 2020-06-10 18:24 马蹄哒哒 阅读(803) 评论(0) 推荐(0)
摘要:--创建主键 create table t1( nid int(11) not null auto_increment, pid int(11), num int(11), primary key(nid,pid) ) engine=innodb default charset=utf8; --创建 阅读全文
posted @ 2020-06-10 18:11 马蹄哒哒 阅读(324) 评论(0) 推荐(0)
摘要:1 import pandas 2 from matplotlib import pyplot 3 pyplot.rcParams['font.sans-serif']=['simhei'] #显示中文标签 4 pyplot.rcParams['axes.unicode_minus']=False 阅读全文
posted @ 2020-06-10 10:46 马蹄哒哒 阅读(567) 评论(0) 推荐(0)
摘要:1 import pandas 2 from matplotlib import pyplot #主要是为了显示图片 3 4 pyplot.rcParams['font.sans-serif']=['simhei'] #显示中文标签 5 pyplot.rcParams['axes.unicode_m 阅读全文
posted @ 2020-06-10 09:45 马蹄哒哒 阅读(194) 评论(0) 推荐(0)
摘要:1 import pandas 2 from matplotlib import pyplot 3 excel=pandas.read_excel('填充日期.xlsx') 4 5 pyplot.rcParams['font.sans-serif']=['simhei'] #显示中文标签 6 pyp 阅读全文
posted @ 2020-06-10 09:22 马蹄哒哒 阅读(551) 评论(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-09 20:33 马蹄哒哒 阅读(271) 评论(0) 推荐(0)
摘要:1 import os 2 3 os.system('notepad') #打开记事本 4 5 os.system('shutdown -s -t 20') #20秒钟以后关机 6 7 os.system('shutdown -a') #取消关机 8 9 os.getcwd() #获取当前的绝对路径 阅读全文
posted @ 2020-06-09 20:31 马蹄哒哒 阅读(177) 评论(0) 推荐(0)
摘要:1 from aip import AipOcr 2 3 """ 你的 APPID AK SK """ 4 APP_ID = 5 API_KEY = 6 SECRET_KEY = 7 8 client = AipOcr(APP_ID, API_KEY, SECRET_KEY) 9 """ 读取图片 阅读全文
posted @ 2020-06-09 20:28 马蹄哒哒 阅读(475) 评论(0) 推荐(0)
摘要:1 from aip import AipSpeech 2 import pygame #两个都可以用来播放 3 """ 你的 APPID AK SK """ 4 5 APP_ID = '' 6 API_KEY = '' 7 SECRET_KEY = '' 8 9 client = AipSpeec 阅读全文
posted @ 2020-06-09 20:27 马蹄哒哒 阅读(207) 评论(0) 推荐(0)
摘要:1 import pdfplumber 2 3 pdf=pdfplumber.open(',,,,,,,.pdf') 4 5 first_page=pdf.pages[0] 6 7 print(first_page.extract_text()) #打印第一页内容 8 9 10 11 #提取其中的表 阅读全文
posted @ 2020-06-09 20:25 马蹄哒哒 阅读(346) 评论(0) 推荐(0)
摘要:1 from pptx import Presentation 2 3 prs=Presentation('名字.pptx') 4 5 for slide in prs.slides: # 读取每一页幻灯片 6 7 for shape in slide.shapes: #获取每一页的内容 8 9 i 阅读全文
posted @ 2020-06-09 20:24 马蹄哒哒 阅读(112) 评论(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-09 20:22 马蹄哒哒 阅读(189) 评论(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-09 20:20 马蹄哒哒 阅读(304) 评论(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-09 20:18 马蹄哒哒 阅读(223) 评论(0) 推荐(0)
摘要:1 from turtle import * 2 bgcolor('red') 3 setup(800,500) 4 5 a={(-126,162):65,(-58,55):65,(-58,-48):65,(-126,-162):65,(-300,50):120} 6 def start(tuple 阅读全文
posted @ 2020-06-09 20:05 马蹄哒哒 阅读(91) 评论(0) 推荐(0)
摘要:1 >>>from openpyxl.utils import get_column_letter,column_index_from string 2 3 >>>get_column_letter(2) 4 5 B 6 7 >>>column_index_from_string('B') 8 9 阅读全文
posted @ 2020-06-09 20:03 马蹄哒哒 阅读(310) 评论(0) 推荐(0)
摘要:1 from openpyxl.styles import Font 2 3 from openpyxl import load_workbook 4 5 excel=load_workbook(r'文件名.xlsx') 6 7 sheet=excel.active 8 9 font=Font(na 阅读全文
posted @ 2020-06-09 20:02 马蹄哒哒 阅读(4512) 评论(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-09 20:00 马蹄哒哒 阅读(79) 评论(0) 推荐(0)
摘要:-- 创建用户 create user '用户名'@'ip地址' identified by 'password'; ip adress 可填%,即指可以在任何电脑上登录 -- 给用户进行授权 (一)grant 权限(select,insert,update) on 数据库名.表名 to '用户名' 阅读全文
posted @ 2020-06-09 19:59 马蹄哒哒 阅读(119) 评论(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-09 19:57 马蹄哒哒 阅读(130) 评论(0) 推荐(0)
摘要:1 from datetime import * 2 today=datetime.today() 3 now=datetime.now() 4 5 #判断今天是星期几 6 today.isoweekday() 7 8 #计算一周以后是星期几 9 day=timedelta(days=7) 10 t 阅读全文
posted @ 2020-06-09 19:54 马蹄哒哒 阅读(221) 评论(0) 推荐(0)
摘要:1 import pandas 2 from matplotlib import pyplot 3 4 #设置中文字体 5 pyplot.rcParams['font.sans-serif']=['simhei'] #显示中文标签 6 pyplot.rcParams['axes.unicode_mi 阅读全文
posted @ 2020-06-09 19:50 马蹄哒哒 阅读(185) 评论(0) 推荐(0)
摘要:1 import pandas 2 from matplotlib import pyplot 3 4 #设置中文字体 5 pyplot.rcParams['font.sans-serif']=['simhei'] #显示中文标签 6 pyplot.rcParams['axes.unicode_mi 阅读全文
posted @ 2020-06-09 19:49 马蹄哒哒 阅读(162) 评论(0) 推荐(0)
摘要:1 import pandas 2 from matplotlib import pyplot 3 excel=pandas.read_excel('填充日期.xlsx') 4 excel.sort_values(by='score',ascending=False,inplace=True) 5 阅读全文
posted @ 2020-06-09 19:48 马蹄哒哒 阅读(152) 评论(0) 推荐(0)
摘要:1 import pandas 2 def price_3_to_7(a): 3 return 3<=a<=7 4 def time_3_to_8(b): 5 return 3<=b<=8 6 7 excel=pandas.read_excel('填充数据.xlsx',header=3,index_ 阅读全文
posted @ 2020-06-09 19:44 马蹄哒哒 阅读(277) 评论(0) 推荐(0)
摘要:1 import pandas 2 excel=pandas.read_excel('填充数据.xlsx',header=3,index_col='id') 3 excel.sort_values(by=['worthy','price'],inplace=True,ascending=[True, 阅读全文
posted @ 2020-06-09 19:43 马蹄哒哒 阅读(396) 评论(0) 推荐(0)
摘要:1 import pandas 2 excel=pandas.read_excel('填充数据.xlsx',header=3,index_col='id') 3 excel['mutiply']=excel['store']*0.5 4 for i in excel.index: 5 excel[' 阅读全文
posted @ 2020-06-09 19:41 马蹄哒哒 阅读(95) 评论(0) 推荐(0)
摘要:1 #在pandas中如果一列出现nan,则会认为他是float类型 2 import pandas 3 from datetime import datetime,timedelta 4 5 #关于月份加一的函数 6 def add_month(d,md): 7 yd=md//12 8 m=d.m 阅读全文
posted @ 2020-06-09 19:39 马蹄哒哒 阅读(226) 评论(0) 推荐(0)
摘要:1 import pandas 2 #Series表示序列,可以表示行或者列 3 4 d={'x':100,'y':300,'z':400} 5 s1=pandas.Series(d) 6 #print(s1.index) #查看其中的索引 7 8 s1=pandas.Series([1,2,3], 阅读全文
posted @ 2020-06-09 19:06 马蹄哒哒 阅读(229) 评论(0) 推荐(0)
摘要: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-09 19:05 马蹄哒哒 阅读(248) 评论(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-09 19:02 马蹄哒哒 阅读(1117) 评论(0) 推荐(0)