Say I have a Pandas Dataframe with 1 column called contracting_department. It has 3 rows of data:
- fire dept. development
- park development
- police development
I am seeing something weird with the parentheses
Scenario 1:
df["contracting_department"] = df["contracting_department"].str.lower()
for i in df.contracting_department:
if ("fire" or "police") in i :
print("IN")
else:
print("NOT IN")
output:
- IN
- NOT IN
- NOT IN
Obviously this is wrong and should be IN, NOT IN, IN.
Scenario 2:
df["contracting_department"] = df["contracting_department"].str.lower()
for i in df.contracting_department:
if "fire" or "police" in i :
print("IN")
else:
print("NOT IN")
Output2:
- IN
- IN
- IN
Any idea what is happening here?