dataframe

#

# 导包
import numpy as np
import pandas as pd
from pandas import Series,DataFrame

dic1={
    'name':['tom','jay','helly'],
    'age':[11,12,33],
    'classRoom':[1,2,3]
}  #数据源
df1=DataFrame(data=dic1)
df2=DataFrame(data=np.random.randint(60,100,size=(3,3)),
              index=['jay','tom','helly'],
             columns=['java','python','c']) #数据源
df1
df2
pd.merge(df1,df2,left_on='name',right_index=True) #合并
pd.merge(df2,df1,left_index=True,right_on='name')
df2.dtypes  #各个列的属性
dataframe 合并

 

posted @ 2019-06-28 21:10  追风zz  阅读(113)  评论(0编辑  收藏  举报