Reputation: 45
I have a specific column in a csv file and I want to write each row of that column as a newline in the same txt file. I'm using Panda if that helps. I can't quite figure out how to iterate over the rows of one specific column.
Upvotes: 1
Views: 2294
Reputation: 472
This should work:
dataframe[colname].to_csv('filepath.txt', sep="\n", index=False)
add header = False
if you don't need the column name in that .txt file
Upvotes: 1