Here is the code:
import pandas as pd
filejan = "01.xls"
filefeb = "02.xls"
roomtype = {
'Room Type Code': ['DLK', 'DTN', 'DTP', 'DKP', 'PTG', 'PKG', 'PTP', 'PKP', 'PKL', 'PTL', 'FPK', 'DLS', 'PRS', 'AVS', 'ASW', 'ASP', 'AVP', 'BFS', 'AVR'],
'Room Type': ['Deluxe', 'Deluxe', 'Deluxe Pool', 'Deluxe Pool', 'Premiere', 'Premiere', 'Premiere', 'Premiere', 'Lagoon', 'Lagoon', 'Family', 'DL Suite', 'PR Suite', 'AS No Pool', 'AS Whirl Pool', 'AS Private Pool', 'Villa', 'Beach Front', 'Residence']
}
mtdjan = pd.read_excel(filejan)
mtdfeb = pd.read_excel(filefeb)
dataRoomType = pd.DataFrame(roomtype, columns=['Room Type Code', 'Room Type'])
def cleanJan(dataFebruary):
dataFebruary.drop([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], axis=0)
dataFebruary.drop(["Unnamed: 3", "Unnamed: 4", "Unnamed: 10", "Unnamed: 13",
"Page -1 of 1", "Unnamed: 6", "Unnamed: 2"], axis=1)
dataFebruary.dropna()
dataFebruary.rename(
columns={
"The xxx Beach Resorts Bali": "Date Create",
"Unnamed: 1": "Name",
"Unnamed: 5": "Room Type Code",
"Unnamed: 7": "Arrival",
"RESERVATION LIST": "Departure",
"Unnamed: 9": "Rate Code",
"Unnamed: 11": "Rate",
"Unnamed: 12": "Company",
"Unnamed: 14": "Segment",
"Unnamed: 15": "Status",
},
)
df1 = cleanJan(mtdjan)
df2 = cleanJan(mtdfeb)
print(df1)
and this is the terminal
==============================================
WARNING *** file size (1195377) not 512 + multiple of sector size (512)
WARNING *** OLE2 inconsistency: SSCS size is 0 but SSAT size is non-zero
*** No CODEPAGE record, no encoding_override: will use 'iso-8859-1'
*** No CODEPAGE record, no encoding_override: will use 'iso-8859-1'
*** No CODEPAGE record, no encoding_override: will use 'iso-8859-1'
WARNING *** file size (1228825) not 512 + multiple of sector size (512)
WARNING *** OLE2 inconsistency: SSCS size is 0 but SSAT size is non-zero
*** No CODEPAGE record, no encoding_override: will use 'iso-8859-1'
*** No CODEPAGE record, no encoding_override: will use 'iso-8859-1'
*** No CODEPAGE record, no encoding_override: will use 'iso-8859-1'
**None**
==========================================