0
def continent_af():
    africa = df[df['cont'] == 'AF' or df['cont'] == 'af']
    return africa
print(continent_af())

So the first half of the second line returned what I wanted, but when I put the or function in, i am getting an error, which reads

the truth value of a series is ambiguous. use a.empty(), a.bool(), a.any(), or a.all()

any help would be much appreciated

bnicholl
  • 306
  • 2
  • 13
  • see this question : http://stackoverflow.com/questions/36921951/truth-value-of-a-series-is-ambiguous-use-a-empty-a-bool-a-item-a-any-o – Mayeul sgc Mar 15 '17 at 03:35

1 Answers1

0

Try:

df[(df['cont'] == 'AF') | (df['cont'] == 'af')]
epnought
  • 66
  • 4