'list object has no attribute split error for csv file

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


Solution 1:[1]

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

Solution 2:[2]

use pandas: example:

covid_training_data = pd.read_csv("covidTrain.csv")

I am kind of curious what this project is tbh

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 VonSquiggs
Solution 2 Atticus Reeves