I have a list of data frames but in a few cases, the list can also contain a string.
df = pd.DataFrame({"df_column":["df_value"]})
a = ['skip',df]
if "skip" in a:
print("yes")
The above gives output as yes because the list contains a string.
But in case if the list doesn't contain a string for eg
df = pd.DataFrame({"df_column":["df_value"]})
a = [df,df]
if "skip" in a:
print("yes")
Now the above code gives an error ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
How can I handle this?