Reputation: 33
B is a dataframe with some companies list
A is a main data frame which has the column of "Companies list". Trying to extract data of data frame 'A' whose companies values are in data frame 'B'. I tried using the below code :
df_a=df_a.loc[df_a['Company'].isin(df_b)]
But this is returning empty output. Below is the data
**df_b**
**Company**
A
B
C
D
E
**df_a**
**Company** **Date** **Orders**
A Mon 1
B Tue 2
R Mon 1
T Mon 1
U Mon 1
T Mon 1
Y Mon 1
R Mon 1
G Mon 1
A Mon 1
A Mon 1
A Mon 1
**Output**
**Company** **Date** **Orders**
A Mon 1
B Tue 2
Upvotes: 0
Views: 20
Reputation: 862511
I think problem is necessary select by column for Series
in df_b
:
df_a=df_a.loc[df_a['Company'].isin(df_b['Company'])]
Upvotes: 1