'TypeError: Can only merge Series or DataFrame objects, a <class 'dict'> was passed

I am new to Python and could not find the answer to this. Basically I am trying to perform Inner Join on two Excel files ( Intraday & endofday ) based on the column "DXLID".

import pandas as pd
import numpy as np
import math

intraday = pd.read_excel("C:/Users/Intraday.xlsx",sheet_name= None)
print(intraday)

endofday = pd.read_excel("C:/Users/EOD.xlsx",sheet_name= None)
print(endofday)

combine = pd.merge(intraday,endofday,on='DXLID')
print(combine)

print(type(intraday))
print(type(endofday))

Sheet1':    DXLID MarketArea  VOL(i)
0   1415        Eur    1.20
1   1617        Eur   10.00
2   1819        Eur    2.00
3   1213        Eur   10.00
4   1234        Eur    0.10
5   5678        Eur    9.00
6  91011        Eur    4.00
7   2223        Eur    0.50
8   2425        Eur    4.00
9   2627        Eur    0.11}
{'Sheet1':     DXLID MarketArea  VOL(eod)
0    1234        Eur      0.10
1    5678        Eur      9.00
2   91011        Eur      4.00
3    1213        Eur     10.00
4    1415        Eur      1.20
5    1617        Eur     10.00
6    1819        Eur      2.00
7    2021        Eur      0.93
8    2223        Eur      0.50
9    2425        Eur      4.00
10   2627        Eur      0.11
11   2829        Eur      1.00
12   3031        Eur      2.00
<class 'dict'>
<class 'dict'>

But I am receiving the error TypeError: Can only merge Series or DataFrame objects, a <class 'dict'> was passed Is there any way to overcome this ? I also checked the object type for both the files & strangely it gave the output as class 'dict' Which is strange because pd.read_excel reads the file into a dataframe so why is it taken as class dict ?

Apologies if the indent of the code & the question isn't great, I am still a newbie.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source