Hey I am currently trying to use data from a csv with my selenium script. Currently using
f = pd.read_csv("Data.csv")
f.head()
for index in range(len(f.index)):
Bestellnummer = f["Bestellnummer"][index]
Sendungsnummer = f["Sendungsnummer"][index]
First row works fine but after that I am getting the error:
"Exception has occurred: TypeError '_io.BufferedWriter' object is not subscriptable"
on the second row...anyone know how to fix this?
One possible approach would be to instead iterate over the rows using .iterrows()
. For example:
import pandas as pd
df = pd.read_csv("Data.csv")
for index, row in df.iterrows():
Bestellnummer = row["Bestellnummer"]
Sendungsnummer = row["Sendungsnummer"]
print(Bestellnummer, Sendungsnummer)
See also: .itertuples()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.