遥指杏花村

博客园 首页 新随笔 联系 订阅 管理
  41 随笔 :: 0 文章 :: 0 评论 :: 50298 阅读

03 2020 档案

摘要:(一)按列分割 列数必须能平分 分成2列 分成4列 np.hsplit(d,2) np.hsplit(d,4) (二)按行分,行必须能平分 分成2行 分成5行 阅读全文
posted @ 2020-03-16 14:19 遥指杏花村 阅读(909) 评论(0) 推荐(0) 编辑

摘要: 阅读全文
posted @ 2020-03-16 14:02 遥指杏花村 阅读(237) 评论(0) 推荐(0) 编辑

摘要:就是方差var的开平方 阅读全文
posted @ 2020-03-16 13:43 遥指杏花村 阅读(300) 评论(0) 推荐(0) 编辑

摘要:(一)垂直合并np.vstack((a,b)) 列数要相同,否则报错。 (二)水平合并np.hstack((a,b)) 行数要相同,否则报错。 阅读全文
posted @ 2020-03-16 13:35 遥指杏花村 阅读(153) 评论(0) 推荐(0) 编辑

摘要:或者写成 阅读全文
posted @ 2020-03-16 13:21 遥指杏花村 阅读(267) 评论(0) 推荐(0) 编辑

摘要:原理 阅读全文
posted @ 2020-03-16 13:06 遥指杏花村 阅读(133) 评论(0) 推荐(0) 编辑

摘要:(一)直接创建 d=np.array([[10,11,12],[20,21,22],[30,31,32]]) (二)创建元组递增数组 d=np.arange(20).reshape(5,4) (三)创建指定范围的递增数组 d=np.arange(10,20).reshape(5,2) (四)创建随机 阅读全文
posted @ 2020-03-16 11:48 遥指杏花村 阅读(15712) 评论(0) 推荐(0) 编辑

摘要:(一)查看某一行 data[2] 结果 array([31,32,33,34]) (二)查看几行 data[[2,4,6]] 结果 array([[31, 32, 33, 34], [51, 52, 53, 54], [71, 72, 73, 74]]) (三)查看1到5行 data[1:6,:] 阅读全文
posted @ 2020-03-15 21:30 遥指杏花村 阅读(222) 评论(0) 推荐(0) 编辑

摘要:1 from datetime import datetime 2 dt=datetime(2020,3,15,15,43,50) 阅读全文
posted @ 2020-03-15 15:15 遥指杏花村 阅读(112) 评论(0) 推荐(0) 编辑

摘要: 阅读全文
posted @ 2020-03-15 10:31 遥指杏花村 阅读(71) 评论(0) 推荐(0) 编辑

摘要: 阅读全文
posted @ 2020-03-15 10:29 遥指杏花村 阅读(96) 评论(0) 推荐(0) 编辑

摘要: 阅读全文
posted @ 2020-03-15 10:19 遥指杏花村 阅读(94) 评论(0) 推荐(0) 编辑

摘要:方法(一)通过字典追加(列名要一致) data={'a':50,'b':60,'c':70} df=df.append(data,ignore_index=True) 方法(二)通过Serise 1 data=pd.Serise([50,60,70],index=list('abc')) 2 df= 阅读全文
posted @ 2020-03-14 22:58 遥指杏花村 阅读(4315) 评论(0) 推荐(0) 编辑

摘要:方法(一)直接赋值 df['D']=80 方法(二)assign追加多列 df = df.assign( AB=df.A+df.B, BC=df.B+df.C ) #追加AB列和BC列 方法(三)条件追加 df['评级']=''df.loc[df['语文']>80,'评级']='优秀' #大于80分 阅读全文
posted @ 2020-03-14 16:31 遥指杏花村 阅读(434) 评论(0) 推荐(0) 编辑

摘要:df['温度']=df['温度'].str.replace('℃','').astype('int32') 阅读全文
posted @ 2020-03-14 15:24 遥指杏花村 阅读(496) 评论(0) 推荐(0) 编辑

摘要:方法(一) plt.subplot(总行数,总列数,序号) x=np.arange(0,7,0.1) y1=np.sin(x) y2=np.cos(x) y3=2*x+6 y4=-2*x+9 plt.subplot(2,2,1) plt.plot(x,y1) plt.subplot(2,2,4) p 阅读全文
posted @ 2020-03-13 21:01 遥指杏花村 阅读(389) 评论(0) 推荐(0) 编辑

摘要:一组彩票数据 (一)统计第a1列 0~9各个数字出现的次数 pd.value_counts(df.a1)或者写成df.a1.value_counts( (二)统计所有的数据中0~9各个数据出现的次数 pd.value_counts(df.values.flatten()) 阅读全文
posted @ 2020-03-13 20:40 遥指杏花村 阅读(235) 评论(0) 推荐(0) 编辑

摘要:有两种方法 (一) plt.rcParams['font.sans-serif']='SimHei'] (二) from matplotlib import font_manager #导入相应模块 font1 = font_manager.FontProperties(fname="C:/Wind 阅读全文
posted @ 2020-03-13 20:25 遥指杏花村 阅读(126) 评论(0) 推荐(0) 编辑

摘要:数据 查询 a1=a2 并且 a1=a3 的所有数据 格式:df[ ( ) & ( ) ] df[(df['a1']==df['a2'])&(df['a1']==df['a3'])] 阅读全文
posted @ 2020-03-13 20:16 遥指杏花村 阅读(277) 评论(0) 推荐(0) 编辑

摘要:原理:把符合条件的数据赋值给中间变量,把中间变量的index作为删除条件 原数据 删除所有 和<100 的数据 tmp=df[df['和']<100] df.drop(tmp.index)# 也可写在一起 df.drop(df[df['和']<100].index) df.drop(5) 删除第五行 阅读全文
posted @ 2020-03-13 11:38 遥指杏花村 阅读(8094) 评论(0) 推荐(0) 编辑

摘要:用requests.get()方法获取网页代码 用beautifulsoup模块解析出图片地址 再用requests模块以图片地址为参数,再发一次请求。 with open as f 以二进制保存图片信息。img.content import requests from bs4 import Bea 阅读全文
posted @ 2020-03-03 14:34 遥指杏花村 阅读(583) 评论(0) 推荐(0) 编辑

摘要:图片代码: 图片地址处的代码大致如下 <div class=img> <a> <img src='http://xxxxxxxxxxx.jpg?&&¥#@'></img> </a> </div> <div class=img> <a> <img src='http://xxxxxxxxxxx.jpg 阅读全文
posted @ 2020-03-03 14:26 遥指杏花村 阅读(208) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示