I need to retrieve the last row of a CSV file, and append it onto the end to extend it any n number of times. I attempted to do this with Pandas:
df = pd.read_csv('file.csv')
last_row = df.iloc[-1]
last_row.to_csv('file.csv', mode='a', header=False)
However, this appends the last row as a single column into the CSV file. Is there a way to properly append the last row column-wise into the CSV file, preferably using Pandas?