2

I'm getting errors from my input function:

from nsepy import get_history

data1 = get_history(symbol='TATAMOTORS', start=date(2018,1,1),end=date(2018,6,7))

data2 = get_history(symbol='ALSEC', start=date(2018,1,1), end=date(2018,6,7))
data3=data1.join(data2)

print(data3)

This is the ValueError output that I receive:

data3=data1.join(data2)
ValueError: columns overlap but no suffix specified: 
Index(['Symbol', 'Series', 'Prev Close', 'Open', 'High', 'Low', 
'Last','Close', 'VWAP', 'Volume','Turnover', 'Trades', 
'Deliverable Volume','%Deliverble'],dtype='object')

Could anyone suggest why I'm getting this error?

ScottMcC
  • 4,094
  • 1
  • 27
  • 35
Pratik
  • 21
  • 1
  • 3

1 Answers1

4

pd.DataFrame.join is used for merging by index, it can be used to combine DataFrames given that they don't have any overlapping columns. What you are looking for is merge instead.

data3 = data1.merge(data2, how='outer')

Notes

There are couple of caveats, you are not importing pandas, date function is an import from datetime.datetime so this should be specified as well.

iDrwish
  • 3,085
  • 1
  • 15
  • 24