Quantcast
Channel: How to remove rows from Pandas dataframe if the same row exists in another dataframe but end up with all columns from both df - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer by kfoley for How to remove rows from Pandas dataframe if the same row...

You can use a left join to get only the id's in the first data frame and not the second data frame while also keeping all the second data frames columns.import pandas as pddf1 = pd.DataFrame(...

View Article



Answer by yatu for How to remove rows from Pandas dataframe if the same row...

Looks like a simple drop will work for what you want:df1.drop(df2.index, errors='ignore', axis=0) col1 col2ID 1 9 52 8 4Note that this assumes that ID is the index, otherwise use...

View Article

How to remove rows from Pandas dataframe if the same row exists in another...

I have two different Pandas data-frames that have one column in common. I have seen similar questions on Stack overflow but none that seem to end up with the columns from both dataframes so please read...

View Article
Browsing latest articles
Browse All 3 View Live




Latest Images