0

I am currently trying to read a specific column from my csv file but when running my script it errors out like this:

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()

I don't know why the script is running into this error so I would be very gald if someone could tell me how to fix this problem and explain what I've made wrong.

This is the content of my csv file:

column1,column2
john,john likes books
tom ,tom likes watching spiderman

This is my script:

col_list = ["column1", "column2"]
df = pd.read_csv("list.csv", usecols=col_list)
input_u = input('gimme a input')
if input_u == df["column1"]:#I think this is the line where the error is caused
    print(df["column2"])

Thank's for every help and suggestion in advance:)

Karl Knechtel
  • 56,349
  • 8
  • 83
  • 124
scripter2
  • 11
  • 2
  • Welcome to Stack Overflow. In the future, please *at least* try copying and pasting that part of your error message into a search engine. – Karl Knechtel Sep 09 '21 at 23:09

0 Answers0