krowe
0
Q:

pandas merge two columns from different dataframes

DataFrame["new_column"] = DataFrame["column1"] + DataFrame["column2"] 
2
df_outer = pd.merge(df1, df2, on='id', how='outer')

df_outer
1
#suppose you have two dataframes df1 and df2, and 
#you need to merge them along the column id
df_merge_col = pd.merge(df1, df2, on='id')
1
df["period"] = df["Year"] + df["quarter"]
1
# Stack the DataFrames on top of each other
vertical_stack = pd.concat([survey_sub, survey_sub_last10], axis=0)

# Place the DataFrames side by side
horizontal_stack = pd.concat([survey_sub, survey_sub_last10], axis=1)
0
df_merge_col = pd.merge(df_row, df3, on='id')

df_merge_col
0
import pandas as pd
T1 = pd.merge(T1, T2, on=T1.index, how='outer')
0
# Import pandas package 
import pandas as pd 
  
# Define a dictionary containing employee data 
data = {'Name':['Jai', 'Princi', 'Gaurav', 'Anuj'], 
        'Age':[27, 24, 22, 32], 
        'Address':['Delhi', 'Kanpur', 'Allahabad', 'Kannauj'], 
        'Qualification':['Msc', 'MA', 'MCA', 'Phd']} 
  
# Convert the dictionary into DataFrame  
df = pd.DataFrame(data) 
  
# select two columns 
df[['Name', 'Qualification']] 
0

New to Communities?

Join the community