pandas
Cloudia8020
这个作者很懒,什么都没留下…
展开
-
pandas之(三)excel行、列
import pandas as pd#定义数据序列s1=pd.Series([1,2,3],index=[1,2,3],name=‘A’)s2=pd.Series([10,20,3],index=[1,2,3],name=‘B’)s3=pd.Series([100,200,300],index=[1,2,3],name=‘C’)#设置行、列对应关系df=pd.DataFrame({s...原创 2019-02-21 15:20:37 · 787 阅读 · 0 评论 -
pandas之(一)创建excel文件
#导入pandasimport pandas as pd#创建表结构并填充内容df = pd.DataFrame({‘ID’:[1,2,3],‘Name’:[‘Tim’,‘Victor’,‘Nick’]})#指下索引列,避免出现重复的索引列df=df.set_index(‘ID’)#输出到指定路径df.to_excel(“e:/hyx/pandas/output1.xlsx”)pr...原创 2019-02-21 10:00:27 · 2195 阅读 · 0 评论 -
pandas之(二)读取excel
代码import pandas as pd#读取指定excel表people=pd.read_excel(“C:/USers/bocom/Desktop/python/pandas/People - 副本.xlsx”)#打印表属性print(people.shape)#打印列print(people.columns)#打印前三条数据(带表头共四行)print(people.hea...原创 2019-02-21 10:27:22 · 1569 阅读 · 0 评论