import pandas as pd
# initialize data of lists.
data = {'Name':['Tom', 'nick', 'krish', 'jack'], 'Age':[20, 21, 19, 18]}
# Create DataFrame
df = pd.DataFrame(data)
# Print the output.
df
a = df['Age'].sum()
b = 50
if b > a:
print("b is greater than a")
elif a == b:
print("a and b are equal")
I got the following error in python
"ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()."
How can I print the if-else condition?
Aucun commentaire:
Enregistrer un commentaire