import pandas as pd
keywords = {"metal", "energy", "team"} # all your keywords
df = pd.read_csv("2008-data-8-8-2016.csv", sep=",")
output = pd.DataFrame(columns=df.columns)
for i in range(len(df.index)):
if any(x in df['Position'][i] for x in keywords):
output.loc[len(output)] = [df[j][i] for j in df.columns]
output.to_csv("ExtractedData_2008.csv", index=False)
This code is supposed to go throw file, and extract data based on the keywords. So it looks for the keywords in position column and take all the related data from other columns and copy them in new file. But I get this error (TypeError: argument of type 'float' is not iterable)
Any one can explain me what's the problem
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire