我正在努力解决这个错误
ValueError: can not merge DataFrame with instance of type <class 'pandas.core.groupby.DataFrameGroupBy'>
其中,我想合并由创建的两个数据帧,其中agg
as
从第一个df i创建的df
^{pr2}$然后我运行了我想要的数据
resi_flats_nooutliers_bysector['updatedprice_calculated'].
agg([np.mean,np.median,np.max,'count'])
resi_all_nooutliers_bysector['updatedprice_calculated'].
agg([np.mean,np.median,np.max,'count'])
然后我试图合并为
df_resi_nooutliers_bysector = pd.merge(resi_all_nooutliers_bysector,
resi_flats_nooutliers_bysector,
on=['postcode_sector'],how='left',
suffixes=('_allprop', '_flats'))
获取标题错误
对我来说,这是有效的,将agg输出保存到一个数据帧中,确保索引在原始索引上(列
postcode_sectors
)然后使用join的索引
^{pr2}$相关问题 更多 >
编程相关推荐