mesclar dois quadros de dados com base na coluna
df_outer = pd.merge(df1, df2, on='id', how='outer') #here id is common column
df_outer
Sachin
df_outer = pd.merge(df1, df2, on='id', how='outer') #here id is common column
df_outer
df_3 = pd.concat([df_1, df_2])
#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')
import pandas as pd
import numpy as np
df1 = pd.DataFrame({'fruit': ['apple', 'banana', 'orange'] * 3,
'weight': ['high', 'medium', 'low'] * 3,
'price': np.random.randint(0, 15, 9)})
df2 = pd.DataFrame({'pazham': ['apple', 'orange', 'pine'] * 2,
'kilo': ['high', 'low'] * 3,
'price': np.random.randint(0, 15, 6)})
out = df1.merge(df2,left_on=('fruit','weight'),right_on=('pazham','kilo'),how='inner',suffixes=('_left','_right')).head(10)
import pandas as pd
T1 = pd.merge(T1, T2, on=T1.index, how='outer')
df["period"] = df["Year"] + df["quarter"]