I was using code from this site (Pandas CSV output only the data in a certain row (to_csv)) to write a dataframe row to a csv row:
df.iloc[-1].to_csv('output.csv', mode='a', index=False, header=False)
but the result is
1
2
3
4
5
instead of
1, 2, 3, 4, 5
What is wrong here?
I want to make this work with df.to_csv and I've tried a few options. I know I could use different code such as with open(...) but the open() function conflicts with another list variable that I cannot change.