pandas join two series on index

Solutions on MaxInterview for pandas join two series on index by the best coders in the world

showing results for - "pandas join two series on index"
Emily
15 Jan 2019
1# credit to Stack Overflow user in the source link
2
3s1 = pd.Series([1, 2], index=['A', 'B'], name='s1')
4s2 = pd.Series([3, 4], index=['A', 'B'], name='s2')
5
6pd.concat([s1, s2], axis=1)
7Out:
8   s1  s2
9A   1   3
10B   2   4
11
12pd.concat([s1, s2], axis=1).reset_index()
13Out:
14  index  s1  s2
150     A   1   3
161     B   2   4