1

I have two series which have the same index. Their basic format is

a =

Index Data_Value
date1  3
date2  56
.      .
.      .
.      .

b =

Index Data_Value
date1  22
date2  34
.      . 
.      .
.      .

Based on previous question answered here, I am trying to join them using:

a.to_frame().join(b.to_frame())

but I get the error:

ValueError: columns overlap but no suffix specified: Index(['Data_Value'], dtype='object')

I thought it might be an issue with the field name,because 'b.name' returns 'Data_Value', so I tried:

a.to_frame().join(b.to_frame(),on='Data_Value' ) but still the same error.

Any guidance very welcome.

ZakS
  • 1,073
  • 3
  • 15
  • 27

2 Answers2

2

There is same names, simpliest is change it in to_frame:

c = a.to_frame('a').join(b.to_frame('b'))
print (c)
        a   b
Index        
date1   3  22
date2  56  34
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252
1

If you want to both value same name using concat

pd.concat([a,b],1)
Out[129]: 
       Data_Value  Data_Value
Index                        
date1           3          22
date2          56          34
BENY
  • 317,841
  • 20
  • 164
  • 234