摘要: import pandas as pd products = pd.read_excel('c:/Temp/List.xlsx',index_col = 'ID') products.sort_values(by =['Worthy','Price'],inplace=True,ascending=[True,False] ) #sort_values 数据排序 ... 阅读全文
posted @ 2019-06-06 11:16 Inserence 阅读(221) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd books = pd.read_excel('e:/Books.xlsx',index_col='ID') for i in books.index: books['Price'].at[i]=books['ListPrice'].at[i]*books['Discount'].at[i] print(books) import pan... 阅读全文
posted @ 2019-06-06 10:54 Inserence 阅读(122) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd from datetime import date,timedelta def add_month(d,md): yd= md//12 m=d.month + md%12 if m !=12: yd += m //12 m = m%12 return date(d.year+yd,m,d.d... 阅读全文
posted @ 2019-05-29 17:49 Inserence 阅读(317) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd d = {'x':100,'y':200,'z':300} s1 =pd.Series(d) print(s1.values) #dic转化为series ---------------------------------------------- [100 200 300] import pandas as pd L1= [100,200,... 阅读全文
posted @ 2019-05-28 19:59 Inserence 阅读(125) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd df = pd.DataFrame({'ID'=[1,2,3],'Name':['Tim','Victor','Nick']}) 创建实例 df.to_excel('D:/Temp/output.xlsx') 创建一个方法 print('Done!') import pandas as pdpeople =pd.read_excel('D:/T... 阅读全文
posted @ 2019-05-28 18:50 Inserence 阅读(215) 评论(0) 推荐(0) 编辑