随笔分类 - pandas
处理excel
摘要:1 import pandas 2 from matplotlib import pyplot 3 4 #设置中文字体 5 pyplot.rcParams['font.sans-serif']=['simhei'] #显示中文标签 6 pyplot.rcParams['axes.unicode_mi
阅读全文
摘要:1 import pandas 2 from matplotlib import pyplot 3 4 #设置中文字体 5 pyplot.rcParams['font.sans-serif']=['simhei'] #显示中文标签 6 pyplot.rcParams['axes.unicode_mi
阅读全文
摘要: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
阅读全文
摘要:import pandas def price_3_to_7(a): return 3<=a<=7 def time_3_to_8(b): return 3<=b<=8 excel=pandas.read_excel('填充数据.xlsx',header=3,index_col='id') exce
阅读全文
摘要: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,
阅读全文
摘要: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['
阅读全文
摘要: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
阅读全文
摘要: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],
阅读全文
摘要:1 import pandas 2 excel=pandas.read_excel('现代征信学.xlsx',index_col='列名',header=None) #header默认为0,指读取第几行,0代表第一行 3 excel.columns=['Id','title','hh','uei',
阅读全文
摘要: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
阅读全文

浙公网安备 33010602011771号