Issue
I've two dataframes that i need to append them in one data frame but the second not like the same shape of the first one, therefore when I try to append them I found the DataFrame like below PS.
`# Reading the old inbound calls DataFrame
IBO_df=pd.read_excel('G:\\Shared drives\\Workforce Team\\Reporting
Team\\Operation Reports\\Bookings Vs Channels\\Tableau
Data.xlsx','Calls old years')
IBO_df.groupby(['Date','Queue']).tail()
#Reading the new inbound calls DataFrame
wb_location=pd.ExcelFile(r'G:\Shared drives\Workforce Team\Real
Time\2022\Real Time YTD.xlsm')
sheets = wb_location.sheet_names[:-1]
IBN_df = pd.read_excel(wb_location, sheet_name = sheets)
for sheet, values in IBN_df.items():
values['Queue'] = sheet
IBN_df=pd.DataFrame((pd.concat(IBN_df)).groupby(['Date','Queue'])
['Offered '].sum()).rename(columns={'Offered ':'Offered
Calls'}).replace('CS','Online Hotels')
IBN_df
#Appending the two reports of Inbound calls.
IB_calls=pd.concat([IBO_df,IBN_df])
IB_calls.tail(50)`
Solution
Try:
out = pd.concat([IBN_df.reset_index(), IBO_df])
Or use_index=False
when you use groupby
.
Answered By - Corralien
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.