Im using str.startswith and if condition to 'do something' if the condition is TRUE. I have been browsing and kind of understand that for the if condition, it is unclear what to do with it. I not sure how exactly how to obtain the solution for my problem. The code I wrote first is:
for i in Bus.index:
if (Bus['NAME'].str.startswith("S")) :
print(i)
This give me error:
"ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()."
I am trying to say:
for i in Bus.index:
if rows in (Bus['NAME'].str.startswith("S")) are True, Then:
print(i)
and if it is false then do nothing.
As I understand it from the suggested post and other searches online, my problem does not have any use of the suggestions given in the error i get or can I see similar example( but I have less trained eye than many others, that could see my logical thinking error, and the keyword is in the beginning of the post
"I kinda understand" and "I not sure how exactly how to obtain the solution for my problem".