lundi 17 août 2020

TypeError: argument of type 'float' is not iterable - reshape csv file


I have a csv file where the first column represents numeric ID and a column that represents users comments.
There are comments that were left out in the ID's column. So, I pretend to check each row in the ID column and if it isn´t numeric, copy that row and paste it in the Comments column (last True in the ID column).

My code:

import pandas as pd

clean_order = pd.read_csv('C:/Users/(...)/Page_Clean_test.csv', 'w+', delimiter=';', skiprows=0, low_memory=False)
save_row = 0

for L in range(0, 1500):
     if "159361" in clean_order['web_scraper_order'][L]:
         save_row = L
     else:
         clean_order['Comments'][save_row] = clean_order['Comments'][save_row] + clean_order['web_scraper_order'][L]

Error:
Traceback (most recent call last): File "C:/Users/suiso/PycharmProjects/Teste_SA/Change web_scraper_order.py", line 12, in if "159361" in clean_order['web_scraper_order'][L]: TypeError: argument of type 'float' is not iterable

Aucun commentaire:

Enregistrer un commentaire