根据另一个数据框选择一个数据框的列 [英] Select Columns of a DataFrame based on another DataFrame

查看:72
本文介绍了根据另一个数据框选择一个数据框的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图根据另一个DataFrame的列选择一个DataFrame的子集.

I am trying to select a subset of a DataFrame based on the columns of another DataFrame.

DataFrames看起来像这样:

The DataFrames look like this:

    a   b   c   d
0   0   1   2   3
1   4   5   6   7
2   8   9  10  11
3  12  13  14  15

   a  b
0  0  1
1  2  3
2  4  5
3  6  7
4  8  9

我想获取两个数据帧中包含的列的第一个数据帧的所有行.我的结果应如下所示:

I want to get all rows of the first Dataframe for the columns which are included in both DataFrames. My result should look like this:

    a   b   
0   0   1   
1   4   5   
2   8   9  
3  12  13    

推荐答案

您可以使用 查看全文

相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆