pandas数据列顺序不同进行concat

  统计/机器学习 Python    浏览次数:6906        分享
0

如果一个数据列

A B C D


另外一个

D B C A

怎么使用concat join merge 弄到一块


弄成 

A B C D

 

constant007   2019-03-22 18:03



   1个回答 
2


df = pd.concat([df1, df2[df1.columns])
SofaSofa数据科学社区DS面试题库 DS面经

派大星   2019-03-22 21:26



  相关讨论

怎么把一个pandas数据框用append的方式添加到现有的csv文件?

怎么查看pd dataframe里每一列的类型?

怎么利用pandas新建一个只有列名的空的dataframe?

怎么按照index对pd.DataFrame的行排序?

pandas dataframe insert报错ValueError: unbounded slice

如何清空pandas dataframe里的全部数据但是保留列名?

怎么对pandas dataframe按照一列的字符串的长度来排序?

pandas.DataFrame的index重新排列(从0开始)

pandas dataframe 乘法得到nan

pandas的groupby报错:ValueError: Length of values does not match length of index

  随便看看

pip install opencv-python失败,难道非要编译安装?

对连续特征一定要进行分箱处理吗?

分类变量,进行One hot编码,维度升高,如何处理?

怎么给plt.subplot加一个主标题?

怎么把pandas dataframe中的一列转成一个list?