蓝绝

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

11 2022 档案

摘要:#设置轴标题 #画布设置颜色和大小 #折线图设置标记样式,,mfc='w'表示空心 import matplotlib.pyplot as plt x=[1,2,3,4,5] y=[2,10,6,7,17] plt.rcParams['font.sans-serif']=['SimHei'] plt 阅读全文
posted @ 2022-11-27 22:18 蓝绝 阅读(348) 评论(0) 推荐(0) 编辑

摘要:#画布设置颜色和大小 #折线图设置标记样式,,mfc='w'表示空心 import matplotlib.pyplot as plt x=[1,2,3,4,5] y=[2,10,6,7,17] plt.figure(facecolor='yellow',figsize=(5,3)) plt.plot 阅读全文
posted @ 2022-11-27 16:03 蓝绝 阅读(101) 评论(0) 推荐(0) 编辑

摘要:#散点图,设置标记样式 import matplotlib.pyplot as plt x=[1,2,3,4,5] y=[2,10,6,7,17] plt.plot(x,y,"r1") #r表示颜色,1表示标记样式(下花三角标记) plt.show() #折线图设置标记样式,,mfc='w'表示空心 阅读全文
posted @ 2022-11-27 15:55 蓝绝 阅读(91) 评论(0) 推荐(0) 编辑

摘要:#设置表颜色和线条灰度值 import matplotlib. pyplot as plt x=[1, 2, 3, 4, 5] y=[10, 20, 30, 40, 50] plt.plot(x,y,color='0.7',linestyle='-.') #设置灰度值为0.7,线条样式为-. plt 阅读全文
posted @ 2022-11-27 15:35 蓝绝 阅读(143) 评论(0) 推荐(0) 编辑

摘要:# 绘制简单图表 import matplotlib.pyplot as plt plt.plot([1,2,3,4,5]) plt.show() #散点图 import matplotlib.pyplot as plt plt.plot([1,2,3,4,5],[2,10,6,7,11],'ro' 阅读全文
posted @ 2022-11-27 14:23 蓝绝 阅读(27) 评论(0) 推荐(0) 编辑

摘要:import pandas as pd pd.set_option('display.unicode.east_asian_width',True) # 规整格式 df=pd.read_excel('电脑配件销售记录.xlsx') print(df.head()) df.to_html('电脑配件销 阅读全文
posted @ 2022-11-27 13:54 蓝绝 阅读(21) 评论(0) 推荐(0) 编辑

摘要:#移动窗口数据计算 import pandas as pd index=pd.date_range('2020-1-1',periods=15,freq='D') #创建Series对象 s=pd.Series(data=[3,6,7,4,2,1,3,8,9,10,12,15,13,22,14],i 阅读全文
posted @ 2022-11-27 13:26 蓝绝 阅读(48) 评论(0) 推荐(0) 编辑

摘要:#统计数据的open,close,high,low的值 import pandas as pd index=pd.date_range('2020-2-3',periods=12,freq='T') #从2020-2-3开始,12个数,间隔为1分钟 s=pd.Series(range(12),ind 阅读全文
posted @ 2022-11-27 13:03 蓝绝 阅读(31) 评论(0) 推荐(0) 编辑

摘要:import pandas as pd index=pd.date_range('2020-1-1',periods=2) s=pd.Series(range(1,3),index=index) #升采样 #s.resample('6H').asfreq() #使用前值填充 #s.resample( 阅读全文
posted @ 2022-11-27 12:47 蓝绝 阅读(19) 评论(0) 推荐(0) 编辑

摘要:import pandas as pd pd.set_option('display.unicode.east_asian_width',True) # 规整格式 df=pd.read_excel('msb课程记录.xls') df=df.set_index('订单付款时间') #df.head() 阅读全文
posted @ 2022-11-27 11:40 蓝绝 阅读(27) 评论(0) 推荐(0) 编辑

摘要:#将一分钟时间序列转换成3分钟, index=pd. date_range('2021-1-1', periods=9, freq='T') s=pd.Series (data=range (9), index=index) #产生3分钟的序列, #s. resample (rule=' 3T', 阅读全文
posted @ 2022-11-27 11:08 蓝绝 阅读(97) 评论(0) 推荐(0) 编辑

摘要:# data_range()函数的使用 import pandas as pd pd.date_range("2021-1-1",periods=10,freq="W") DatetimeIndex(['2021-01-03', '2021-01-10', '2021-01-17', '2021-0 阅读全文
posted @ 2022-11-27 10:40 蓝绝 阅读(34) 评论(0) 推荐(0) 编辑

摘要:#按时期统计并显示数据 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) # 规整格式 df=pd.read_excel('msb课程销售记录.xlsx') #df.head() df=df[['订单 阅读全文
posted @ 2022-11-27 10:31 蓝绝 阅读(88) 评论(0) 推荐(0) 编辑

摘要:#按不同时期统计数据 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) # 规整格式 df=pd.read_excel('日期.xlsx') df=df.set_index('订单付款日期.xlsx' 阅读全文
posted @ 2022-11-27 10:07 蓝绝 阅读(23) 评论(0) 推荐(0) 编辑

摘要:#获取指定区域的数据 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) # 规整格式 df=pd.read_excel('msb课程销售记录.xlsx') #df.head() df=df[['订单付 阅读全文
posted @ 2022-11-27 09:48 蓝绝 阅读(41) 评论(0) 推荐(0) 编辑

摘要:# #dt对象的使用 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) # 规整格式 df=pd.read_excel('日期.xlsx') df['日期']=pd. to_datetime (df[ 阅读全文
posted @ 2022-11-27 09:45 蓝绝 阅读(55) 评论(0) 推荐(0) 编辑

摘要:##将各种日期字符串转成日期格式 #将各种日期字符串转成日期格式 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) # 规整格式 df=pd.DataFrame({'原日期':['14-Feb-20' 阅读全文
posted @ 2022-11-21 23:06 蓝绝 阅读(156) 评论(0) 推荐(0) 编辑

摘要:# #导出到csv文件 import pandas as pd df=pd.DataFrame( {'编号':['1001','1002','1003'], '姓名':['张三','李四','王五'], '总成绩':[740,658,543] }) df #导出到csv文件,不显示索引,导出列为[' 阅读全文
posted @ 2022-11-21 22:10 蓝绝 阅读(50) 评论(0) 推荐(0) 编辑

摘要:##数据导出,保存成Excel文件 #数据导出,保存成Excel文件 import pandas as pd df=pd.DataFrame( {'编号':['1001','1002','1003'], '姓名':['张三','李四','王五'] }) df df.to_excel('数据导出-学生 阅读全文
posted @ 2022-11-20 22:38 蓝绝 阅读(168) 评论(0) 推荐(0) 编辑

摘要:#纵向表合并--行相加 #concat方法,纵向数据合并(表结构相同,首尾相连) import pandas as pd df1=pd.read_excel('数据合并concat.xlsx', sheet_name='Sheetl') df2=pd.read_excel('数据合并concat.x 阅读全文
posted @ 2022-11-20 22:06 蓝绝 阅读(598) 评论(0) 推荐(0) 编辑

摘要:#数据合并一对一 #相同的列进行合并 import pandas as pd df1=pd.read_excel('student1.xlsx') df2=pd.read_excel('student2.xlsx') #dfl #测试数据读取 #数据合并 new_df=pd.merge(df1,df 阅读全文
posted @ 2022-11-20 21:30 蓝绝 阅读(40) 评论(0) 推荐(0) 编辑

摘要:#数据位移 #数据位移 import pandas as pd data=[7532, 3937, 9447, 8765, 4564] index=[1, 2, 3, 4, 5] df=pd. DataFrame (data=data, index=index, columns=['OPPO' ]) 阅读全文
posted @ 2022-11-20 17:37 蓝绝 阅读(33) 评论(0) 推荐(0) 编辑

摘要:#通过字典进行分组统计 #通过字典进行分组统计 import pandas as pd pd.set_option ( 'display.unicode.east_asian_width', True) pd.set_option ('display.max_columns',500) pd.set 阅读全文
posted @ 2022-11-20 17:19 蓝绝 阅读(28) 评论(0) 推荐(0) 编辑

摘要:#自定义函数实现分组统计 #能过自定义的函数实现分组统计 import pandas as pd df=pd.read_excel('电脑配件销售记录.xlsx') #print (df. head ())) #回顾知识点 # print (type (df['产品名称'])) #Series pr 阅读全文
posted @ 2022-11-20 16:26 蓝绝 阅读(33) 评论(0) 推荐(0) 编辑

摘要:##分组对列采用聚合函数 #分组对列采用聚合函数 import pandas as pd pd.set_option ('display.unicode.east_asian_width',True) df=pd.read_excel('电脑配件销售记录.xlsx') #print(df.head( 阅读全文
posted @ 2022-11-20 15:47 蓝绝 阅读(165) 评论(0) 推荐(0) 编辑

摘要:##分组数据选代 (遍历分组) for name, group in df1.groupby('产品名称'): #分组数据选代 #分组并按指定列进行计算 import pandas as pd pd.set_option ('display.unicode.east_asian_width',Tru 阅读全文
posted @ 2022-11-20 15:15 蓝绝 阅读(60) 评论(0) 推荐(0) 编辑

摘要:##按照一列分组统计 #按照一列分组统计 import pandas as pd pd.set_option ('display.unicode.east_asian_width',True) df=pd.read_excel('电脑配件销售记录.xlsx') print (df) print (' 阅读全文
posted @ 2022-11-20 14:28 蓝绝 阅读(138) 评论(0) 推荐(0) 编辑

摘要:#apply(), map(), applymap()区别 apply()可用于Series和DataFrame,DataFrame只能运用到一行或一列,如合计的新增列 map()只适用于Series applymap()将函数应用到DataFrame中的每一个元素中 # apply(), map( 阅读全文
posted @ 2022-11-20 12:26 蓝绝 阅读(76) 评论(0) 推荐(0) 编辑

摘要:##设置千位分隔符 apply() #设置千位分隔符 apply() import pandas as pd pd.set_option ('display.unicode.east_asian_width',True) df=pd.read_excel ('msb课程记录.xls') print 阅读全文
posted @ 2022-11-20 11:28 蓝绝 阅读(132) 评论(0) 推荐(0) 编辑

摘要:# apply()设置百分比 map ()设置百分比 #设置百分比 import pandas as pd df=pd.read_excel ('格式化数据.xls') print (df) print('1. apply()设置百分比 ') df['百分比']=df ['A1']. apply ( 阅读全文
posted @ 2022-11-20 11:11 蓝绝 阅读(134) 评论(0) 推荐(0) 编辑

摘要:#设置小数位数 import pandas as pd pd.set_option ('display.unicode.east_asian_width', True) df=pd.read_excel('格式化数据.xls') print (df) print (df.round(2)) #对df 阅读全文
posted @ 2022-11-20 10:50 蓝绝 阅读(77) 评论(0) 推荐(0) 编辑

摘要:#求标准差 #求标准差 import pandas as pd pd.set_option ('display.unicode.east_asian_width', True) data=[[100,90,100],[100,76,76],[76,90,76]] columns=['数学','语文' 阅读全文
posted @ 2022-11-19 22:57 蓝绝 阅读(169) 评论(0) 推荐(0) 编辑

摘要:#求众数 import pandas as pd pd.set_option ('display.unicode.east_asian_width', True) data=[[100,90,100],[100,76,76],[76,90,76]] columns=['数学','语文','英语'] 阅读全文
posted @ 2022-11-19 20:33 蓝绝 阅读(81) 评论(0) 推荐(0) 编辑

摘要:#最大最小值-中位数 import pandas as pd pd.set_option ('display.unicode.east_asian_width', True) data=[[100,90,80],[98,67,56],[56,56,45]] columns=['数学','语文','英 阅读全文
posted @ 2022-11-19 20:03 蓝绝 阅读(69) 评论(0) 推荐(0) 编辑

摘要:#求和 和 计算平均值 import pandas as pd pd.set_option ('display.unicode.east_asian_width', True) data=[[100,90,80],[98,67,56],[56,56,45]] columns=['数学','语文',' 阅读全文
posted @ 2022-11-19 19:59 蓝绝 阅读(137) 评论(0) 推荐(0) 编辑

摘要:#按某列数据大小排名 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) # 规整格式 df=pd.read_excel('电脑配件销售记录.xlsx') df['顺序排名']=df['数量'].ran 阅读全文
posted @ 2022-11-19 19:42 蓝绝 阅读(72) 评论(0) 推荐(0) 编辑

摘要:#按某列降序排序 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) # 规整格式 df=pd.read_excel('电脑配件销售记录.xlsx') print(df.head()) #head() 阅读全文
posted @ 2022-11-19 19:37 蓝绝 阅读(17) 评论(0) 推荐(0) 编辑

摘要:#设置某列为行索引 import pandas as pd df=pd.read_excel('msb课程记录.xls') #print(df) df=df.set_index (['买家会员名']) print(df) 买家实际支付金额 课程总数量 课程标题 类别 \ 买家会员名 msb001 3 阅读全文
posted @ 2022-11-19 16:31 蓝绝 阅读(35) 评论(0) 推荐(0) 编辑

摘要:#重新设置索引,多出的索引数据填充 #重新设置索引,多出的索引数据填充 import pandas as pd s=pd.Series([11, 22, 33], index=[1,2,3]) print(s) #重新设置索引 print(s.reindex(range(1, 6))) #多出来两为 阅读全文
posted @ 2022-11-19 16:12 蓝绝 阅读(32) 评论(0) 推荐(0) 编辑

摘要: 阅读全文
posted @ 2022-11-19 15:06 蓝绝 阅读(20) 评论(0) 推荐(0) 编辑

摘要:#查看空值情况 import pandas as pd pd.set_option("display.unicode.east_asian.width",True) df=pd.read_excel('msb课程记录.xls') print(df) print(' ') print(df.info( 阅读全文
posted @ 2022-11-19 15:02 蓝绝 阅读(103) 评论(0) 推荐(0) 编辑

摘要:#删除数据 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) data=[[45,65,100],[56,45,50],[67,67,67]] index=['张三','李四','王五'] colum 阅读全文
posted @ 2022-11-19 13:00 蓝绝 阅读(48) 评论(0) 推荐(0) 编辑

摘要:#修改行索引 #数据的修改,修改行索引标题 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) data=[[45,65,100],[56,45,50],[67,67,67]] index=['张三', 阅读全文
posted @ 2022-11-19 11:53 蓝绝 阅读(83) 评论(0) 推荐(0) 编辑

摘要:#按列增加 #数据的增加-按列增加 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) data=[[45,65,100],[56,45,50],[67,67,67]] index=['张三','李四' 阅读全文
posted @ 2022-11-19 11:05 蓝绝 阅读(30) 评论(0) 推荐(0) 编辑

摘要:#按条件提取数据 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) data=[[45,65,100],[56,45,50],[67,67,67]] index=['张三','李四','王五'] co 阅读全文
posted @ 2022-11-19 10:31 蓝绝 阅读(112) 评论(0) 推荐(0) 编辑

摘要:#提取区域数据 import pandas as pd pd.set_option('display.unicode.east_asian_width',True) data=[[45,65,100],[56,45,50],[67,67,67]] index=['张三','李四','王五'] col 阅读全文
posted @ 2022-11-19 10:15 蓝绝 阅读(29) 评论(0) 推荐(0) 编辑

摘要:数据抽取. DataFrame对象的loc属性与iloc属性. loc属性 以列名(columns)和行名(index)作为参数,当只有一个参数时,默认是行名,即抽取整行数据,包括所有列。 iloc属性 以行和列位置索引(即:0,1,2,.)作为参数,0表示第一行,1表示第2行,以此类推。当只有一个 阅读全文
posted @ 2022-11-19 09:55 蓝绝 阅读(46) 评论(0) 推荐(0) 编辑

摘要:*导入CSV文件. pd.read_csv(filepath_or_buffer,sep=',header,encoding=None) 常用参数说明.# filepath_or_buffer:字符串、文件路径,也可以是URL链接# sep:字符串、分隔符.# header:指定作为列名的行,默认值 阅读全文
posted @ 2022-11-18 22:59 蓝绝 阅读(64) 评论(0) 推荐(0) 编辑

摘要:导入外部数据 导入.xls或.xlsx文件. pd.read_excel(io,sheet_name,header)常用参数说明. io:表示.xls或.xlsx文件路径或类文件对象. sheet_name:表示工作表,取值如下表所示. header:默认值为0,取第一行的值为列名,数据为除列名以外 阅读全文
posted @ 2022-11-18 22:29 蓝绝 阅读(356) 评论(0) 推荐(0) 编辑

摘要:import pandas as pd data=[['小太阳',320.9, 100], ['鼠标', 150.3, 50], ['小刀', 1.5, 200]] columns=['名称','单价','数量'] df=pd. DataFrame (data=data, columns=colum 阅读全文
posted @ 2022-11-18 22:14 蓝绝 阅读(38) 评论(0) 推荐(0) 编辑

摘要:#字典方式创建DataFrame对象 #如果某列数据相同,写一个值就可以 import pandas as pd data= {'名称':['小太阳','鼠标','小刀'],'单价':[320.9,150.3,1.5], '数量': [100,50,200]} df=pd. DataFrame (d 阅读全文
posted @ 2022-11-18 13:54 蓝绝 阅读(48) 评论(0) 推荐(0) 编辑

摘要:# #列表方式创建DataFrame对象 import pandas as pd data=[['小太阳',320.9, 100], ['鼠标', 150.3, 50], ['小刀', 1.5, 200]] columns=['名称','单价','数量'] df=pd. DataFrame (dat 阅读全文
posted @ 2022-11-18 13:22 蓝绝 阅读(26) 评论(0) 推荐(0) 编辑

摘要:2) pandas中NoneSnp.nan的操作 isnull () notnull () dropna () :过滤丢失数据 fillna () :填充丢失数据 (1)判断函数 isnull () . notnull() (2)过滤函数 阅读全文
posted @ 2022-11-17 22:46 蓝绝 阅读(72) 评论(0) 推荐(0) 编辑

摘要:1. pandas. 构造: Series一维数组,类似字典 Series (data, index) Series (data=dic, index) 读取DataFrame的一列 索引访问: 字典访问: s[key] 下标访问: s[index] loc访问:s. loc [key] iloc访 阅读全文
posted @ 2022-11-17 22:03 蓝绝 阅读(24) 评论(0) 推荐(0) 编辑

摘要:(1) DataFrame之间的运算同Series一样: . 在运算中自动对齐相同索引的数据. 如果索引不对应,则补NaN DataFrame和一个数、numpy 广播机制 DataFrame和数组(Series) 索引对齐, axis控制方向 DataFrameDataFrame 索引对齐,不分方 阅读全文
posted @ 2022-11-17 21:51 蓝绝 阅读(152) 评论(0) 推荐(0) 编辑

摘要:2) DataFrame的索引 (1)对列进行索引 -通过类似字典的方式 -通过属性的方式 可以将DataFrame的列获取为一个Series。返回的Series拥有原DataFrame相同的索引,且name属性也已经设置好了,就是相应的列名。 (2)对行进行索引 -使用.ix[]来进行行索引使用. 阅读全文
posted @ 2022-11-17 15:08 蓝绝 阅读(990) 评论(0) 推荐(0) 编辑

摘要:1) DataFrame的创建 最常用的方法是传递一个字典来创建。DataFrame以字典的键作为每一【列】的名称,以字典的值(一个数组)作为每一列。 此外,DataFrame会自动加上每一行的索引(和Series一样)。 同Series一样,若传入的列与字典的键不匹配,则相应的值为NaN。 #数据 阅读全文
posted @ 2022-11-15 21:58 蓝绝 阅读(128) 评论(0) 推荐(0) 编辑

摘要:4) Series的运算 (1)适用于numpy的数组运算也适用于Series (2) Series之间的运算. 在运算中自动对齐不同索引的数据. 如果索引不对应,则补NaN 注意:要想保留所有的index,则需要使用 (意思是没有相同的显示索引时,前面数有值,后面数无值导致无法计算输出NaN,如果 阅读全文
posted @ 2022-11-14 22:42 蓝绝 阅读(117) 评论(0) 推荐(0) 编辑

摘要:3) Series的基本概念 可以把Series看成一个定长的有序字典 可以通过shape, size, index,values等得到series的属性 可以使用head(),tail()分别查看前n个和后n个值 当索引没有对应的值时,可能出现缺失数据显示NaN (not a number )的情 阅读全文
posted @ 2022-11-14 22:02 蓝绝 阅读(308) 评论(0) 推荐(0) 编辑

摘要:#其他访问方式,列表和numpy的访问方式完全适用于Series arr =np.random.randint(0,100,size=5) arr array([38, 15, 10, 85, 81]) s=Series(data=arr,index=["tom", "lucy", "mery", 阅读全文
posted @ 2022-11-13 22:26 蓝绝 阅读(64) 评论(0) 推荐(0) 编辑

摘要:1.Series Series是一种类似于一维数组的对象,由下面两个部分组成: #values :-组数据(ndarray类型) #index :相关的数据索引标签 一维数组:有序的数据类型相同的集合 Series: 一维数组的强化版,增加了像字典一样的key-value的访问机制,同时也保留了数组 阅读全文
posted @ 2022-11-13 21:29 蓝绝 阅读(131) 评论(0) 推荐(0) 编辑

摘要:1,查看文档: shift+tab 2,输入输出历史: In Out 3. %time %timeit %%time %%timeit numpy: 1,特点:数据类型相同的有序的数据集合,如果初始化的数据类型不同,会强制类型统一 优先级: str >float > int 2.构造: np. ar 阅读全文
posted @ 2022-11-13 18:13 蓝绝 阅读(19) 评论(0) 推荐(0) 编辑

摘要:3.其他聚合操作 Function Name NaN-safe Version Description np. sum np. nansum Compute sum of elements #求和 np. prod np. nanprod Compute product of elements #求 阅读全文
posted @ 2022-11-13 15:53 蓝绝 阅读(23) 评论(0) 推荐(0) 编辑

摘要:3.变形 使用reshape函数,注意参数是一个tuple! #产生0-10的随机整数 arr6 = np.random.randint(0,10,size=(20)) arr6 array([2, 8, 9, 6, 2, 6, 6, 1, 0, 1, 3, 5, 1, 3, 8, 5, 0, 8, 阅读全文
posted @ 2022-11-13 15:20 蓝绝 阅读(47) 评论(0) 推荐(0) 编辑

摘要:三、ndarray的基本操作 索引和切片 1.索引维与列表完全一致 多维时同理 2.切片维与列表完全一致多维时同理 将数据反转,例如[1,2,3] >[3,2,1] 两个::进行切片 1.索引维与列表完全一致 多维时同理 #列表的访问方式 arr2 = np.array ([[1, 2, 3], [ 阅读全文
posted @ 2022-11-13 13:58 蓝绝 阅读(140) 评论(0) 推荐(0) 编辑

摘要:1.numpy数组用列表直接创建 import numpy as np age=[15,16,18] #创建列表,后面赋值列表 array3=np.array(age,dtype=np.float64) #用自带的 np.float64 比较全面 array3 array([15., 16., 18 阅读全文
posted @ 2022-11-12 22:49 蓝绝 阅读(62) 评论(0) 推荐(0) 编辑

摘要:一.创建Array 使用np.array()由python list创建 C 数组的概念:数据类型一致的一个连续的内存空间 python list 列表 (C语言说:列表其实就是一个指针数组),列表不要求数据类型一致, numpy的构建是采用c语言,数组类型要保持一致 numpy默认ndarray的 阅读全文
posted @ 2022-11-12 21:36 蓝绝 阅读(29) 评论(0) 推荐(0) 编辑

摘要:二. IPython 的使用技巧 #通过命令来获得帮助文档 1.使用help() #示例 help(len) 2.使用? #示例 len? 3. shift+tab 查看文档 #示例 len() #按shift+tab #tab代码自动补全 按 TAB键 实现代码补全 三. IPython的魔法命令 阅读全文
posted @ 2022-11-12 19:39 蓝绝 阅读(98) 评论(0) 推荐(0) 编辑

摘要:cell单元格 单元格有两个【状态】: 选中状态:没有光标闪动,此出可以对整个单元格操作,比如洲除单元格、新增一个单元格、复制、枯贴、被销、切换模式... 编辑状态:能看到光标在闪动, 此时可以在单元格内部写代码或文本 编姆状态 >选中状态 按下ESC 选中状态一>编料状态 按下Enter 单元络有 阅读全文
posted @ 2022-11-12 19:09 蓝绝 阅读(109) 评论(0) 推荐(0) 编辑

摘要:1.使用pip安装jupyter拓展包,本人选择在cmd中安装 pip install jupyter_contrib_nbextensions 2.配置 nbextension,前提是先关闭jupyter notebook jupyter contrib nbextension install - 阅读全文
posted @ 2022-11-10 22:13 蓝绝 阅读(307) 评论(0) 推荐(0) 编辑

摘要:如何创建Series对象 pd.Series(data,index=index) 1. import pandas as pd data=['李光地','张红云','王鹏'] #data翻译为数据,给变量赋值 s=pd.Series(data=data,index=[1, 2, 3]) #给索引赋值 阅读全文
posted @ 2022-11-10 22:05 蓝绝 阅读(74) 评论(0) 推荐(0) 编辑

摘要:#批量处理单元格判断数据,分数筛选 function 分数筛选(){ var Arr1=[]; var Arr2=Range("a2:b13").Value(); for (var ar of Arr2){ if (ar[1]>=100){ Arr1.push(ar) //数组中添加元素 } } R 阅读全文
posted @ 2022-11-06 16:03 蓝绝 阅读(54) 评论(0) 推荐(0) 编辑

摘要:#批量拆分工作表 function 批量拆分工作表(){ for (var sh of Sheets){ sh.Copy(); ActiveWorkbook.SaveAs("F:\\JavaScriptworkbook\\"+sh.Name) ActiveWorkbook.Close(); } } 阅读全文
posted @ 2022-11-06 15:45 蓝绝 阅读(111) 评论(0) 推荐(0) 编辑

摘要:#6.批量创建工作簿 function 批量创建工作簿(){ for(var city of ["成都","上海","北京"]){ Workbooks.Add(); ActiveWorkbook.SaveAs("F:\\JavaScriptworkbook\\"+city); //增加工作表时,直接 阅读全文
posted @ 2022-11-06 15:35 蓝绝 阅读(108) 评论(0) 推荐(0) 编辑

摘要:#批量创建工作表 function 批量创建工作表(){ for(var city of ["成都","上海","北京"]){ //遍历选中的列数据 Worksheets.Add(); //按列表添加工作表 ActiveSheet.Name=city; //增加工作表时,直接加上名字 } } 阅读全文
posted @ 2022-11-05 22:16 蓝绝 阅读(101) 评论(0) 推荐(0) 编辑

摘要:# function test9() { for (var score of Range("b2:b17")){ //遍历选中的列数据 if (score.Value2>=90){ //判断成绩是否大于90 Console.log("优秀") //判断大于90为优秀 } else { Console 阅读全文
posted @ 2022-11-05 21:54 蓝绝 阅读(41) 评论(0) 推荐(0) 编辑

摘要:function test1() //循环列表 { for (var txt of ["张三","李四","王麻子"]){ Console.log(txt) //立即窗口显示 } } function test2() //循环字符串 { for (var txt of "javascript"){ 阅读全文
posted @ 2022-11-05 21:41 蓝绝 阅读(151) 评论(0) 推荐(0) 编辑

摘要:#//在本工作簿路径下新增工作簿并输入数据 //在本工作簿路径下新增工作簿并输入数据 function test() //声明函数,函数名字为text { var wb=ThisWorkbook; //赋值ThisWorkbook 当前点击的工作簿 var ph=wb.Path; //获取工作表路径 阅读全文
posted @ 2022-11-05 21:36 蓝绝 阅读(54) 评论(0) 推荐(0) 编辑

摘要:JavaScript 菜鸟教程网站,主要学习语法 https://www.runoob.com/js/js-tutorial.html JavaScript WPS开发文档 主要查看WPS API 表格具体介绍用法 https://open.wps.cn/docs/client/wpsLoad 阅读全文
posted @ 2022-11-05 13:38 蓝绝 阅读(725) 评论(0) 推荐(0) 编辑

摘要:#获取表格单元格,修改字体样式 修改字体样式 Font(name=字体名称,size=字体大小,bold=是否加粗,italic=是否斜体,color=字体颜色) 获取表格中字体的样式 cell.font.属性 设置对齐样式 Alignment(horizontal=水平对齐方式,vertical= 阅读全文
posted @ 2022-11-03 21:21 蓝绝 阅读(249) 评论(0) 推荐(0) 编辑

摘要:#找到每条41码的鞋子的信息添加到新的表 #coding:utf-8 import openpyxl #导入库 workbook=openpyxl.load_workbook('京东鞋子评论信息.xlsx') #加载工作簿 sheet=workbook['mysheet'] #获取工作表 #获取所有 阅读全文
posted @ 2022-11-03 20:55 蓝绝 阅读(50) 评论(0) 推荐(0) 编辑

摘要:创建工作表 workbook.create_sheet(sheet名称) 删除工作表 workbook.remove(sheet实例) 复制工作表 workbook.copy_worksheet(sheet实例) 修改工作表名称 sheet.title 冻结窗格 sheet.freeze_panes 阅读全文
posted @ 2022-11-02 15:22 蓝绝 阅读(178) 评论(0) 推荐(0) 编辑

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