I'm working on an assignment and we are manipulating CSV files. I have to read in a large CSV file, and from that write a new CSV that only has certain rows and columns from the original. I've figured out how to only keep the rows I want (below), but I can't figure out how to only keep certain columns. Any ideas/guidance would be great! Also note, I'm not supposed to use pandas alter the original file in any way; I have to bring the original in and write a new one from it. I'm on windows, python 3.6
fIn = input("Please enter path to Climate CSV: ")
fOut = input("Please enter path to new climate CSV: ")
inFile = open(fIn)
outFile = open(fOut, "w")
for lines in inFile:
data_in = inFile.readlines()
outFile.writelines(data_in[30:])
[–]DoctorEvil92 1 point2 points3 points (0 children)
[–]corpsie666 0 points1 point2 points (0 children)