iam trying to add a totally different row before the data frame and i want to ignore the already existing header.
df1
A B C D E F G H
0 ABC1234 123 abc 45 64 34 Aruna 67044
1 DEF2344 345 red 34 43 56 Jason 83234
df2
'HEADER|'+ str(ODATE) + '|' + (str(ODATE-datetime.timedelta(days=1)))
But It is coming like this:
HEADER|20221008|20221007||||||||
ABC1234|123|abc|45|64|34|Aruna|67044
DEF2344|345|red|34|43|56|Jason|83234
I want output like this:
HEADER|20221008|20221007
ABC1234|123|abc|45|64|34|Aruna|67044
DEF2344|345|red|34|43|56|Jason|83234
I am using below code to get the date and concatanate both dataframes
const = 'HEADER|'+ str(ODATE) + '|' + (str(ODATE-datetime.timedelta(days=1)))
df2 = pd.Series([const])
df3 = pd.concat([df2,df1],ignore_index=True)
df3.to_csv(final_output_file, index=False,sep='|',header=False)
How to get only like this at top HEADER|20221008|20221007