merge on index pandas
pd.merge(df1, df2, left_index=True, right_index=True)
merge on index pandas
pd.merge(df1, df2, left_index=True, right_index=True)
pandas join two series on index
# credit to Stack Overflow user in the source link
s1 = pd.Series([1, 2], index=['A', 'B'], name='s1')
s2 = pd.Series([3, 4], index=['A', 'B'], name='s2')
pd.concat([s1, s2], axis=1)
Out:
s1 s2
A 1 3
B 2 4
pd.concat([s1, s2], axis=1).reset_index()
Out:
index s1 s2
0 A 1 3
1 B 2 4
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us