Please help me understand what is wrong with my code, I simply can't figure it out
with open("floo.csv", 'r') as infile:
reader = csv.reader(infile, delimiter=",")
with open('departments_upd.csv','w',newline='') as csvout:
writer = csv.writer(csvout)
for row in reader:
df = row.split(".")
bleep = df[1] '.' df[0] '.' df[2]
writer.writerow(row)
return bleep
CodePudding user response:
Can you give an example of the 'row' variable? Basically, it is saying that you can not use the 'split' method on a variable of type 'list'. If it is a list of index 1, you could just convert it to a string and then use the split method by adding a line:
row_str = row[0]
and then using the split method
CodePudding user response:
use pandas: example:
covid_training_data = pd.read_csv("covidTrain.csv")
I am kind of curious what this project is tbh