I have a hudge csv file with 15 columns and a lot of lines.I use pandas
to keep only 5 columns in a new csv file.
new csv file.
ID, age, number of played game, ratio, Namexx:xx:xx:xx:xx:xx, 19, 52, 33.0, GhostHotel
What i want to do is for each index value extract them from the entire line and print each value in a txt file.
expected task.
id.txt age.txt number_of_pg.txt ratio.txt Name.txt
I use the following code but this only print one value in a row.
import csvwith open('midvalues.csv') as player: csv_reader = csv.reader(player) for index, row in enumerate(csv_reader): if index == 6: print(row[4])
How can i save each value to his specific txt file ?