Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

combine 2 dataframes based on equal values in columns

import pandas as pd
pd.merge(df1, df2, on="Name")

#Only rows are kept for which common keys are found in both data frames. 
#In case you want to keep all rows from the left data frame and only add values from df2 
#where a matching key is available, you can use how="left":

pd.merge(df1, df2, on="Name", how="left")
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #combine #dataframes #based #equal #values #columns
ADD COMMENT
Topic
Name
8+1 =