import pandas as pd

df = pd.read_csv('/BMO_REPORTS_REGRESSION/V16_Upgrade/UAT/$[ReconcileDate]/base2/Calypso_EOD_MPE_Deal_Level_North_America_ALL$[ReconcileDate].csv', sep='|', skiprows=[0], skipfooter=2)

#df.head()

df.columns = df.columns.str.replace('[., ,/,-]','_')

out = spark.createDataFrame(df.astype(str))

out.createOrReplaceTempView('BaseCode')


import pandas as pd

df = pd.read_csv('/BMO_REPORTS_REGRESSION/V16_Upgrade/UAT/$[ReconcileDate]/base2/POPSS/NonCore_IBG_Manual_File_CC Basel_Reporting_$[ReconcileDate1].csv', skiprows=[0])

#df.head()

df.columns = df.columns.str.replace('[., ,/,-]','_')

out = spark.createDataFrame(df.astype(str))

out.createOrReplaceTempView('BaseCode')


import pandas as pd

df = pd.read_csv('/BMO_REPORTS_REGRESSION/V16_Upgrade/UAT/$[ReconcileDate]/base2/Calypso_EOD_MPE_Leg_Level_North_America_ALL$[ReconcileDate].csv', engine='python', sep='|', skiprows=[0], skipfooter=2)

#df.head()

df.columns = df.columns.str.replace('[., ,/,-]','_')

out = spark.createDataFrame(df.astype(str))

out.createOrReplaceTempView('BaseCode')


import pandas as pd


df = pd.read_csv('/BMO_REPORTS_REGRESSION/V16_Upgrade/UAT/$[ReconcileDate]/run2/CALYPSO_MRP_GL_$[ReconcileDate].txt', skiprows=[0],skipfooter=1, delimiter = '|', names=["Trade_Id","Product_Type","Transit","GLM_Account","Ccy","DR_CR_Code","Amount","Code_block"])

#ds = df.iloc[1:].iloc[:-1]

spark.createDataFrame(df.astype(str)).createOrReplaceTempView('RunCode')