0

I'm trying to annotate a plot conditional on a value of a variable:

for i, txt in enumerate(vectors.word):
     if vectors['count']>=50:
     plt.annotate(txt, (yframe.x[i], yframe.y[i]), fontsize=20)

But I get a ValueError:

The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()

Any ideas what is wrong with my conditional statement?

Vinícius Figueiredo
  • 6,300
  • 3
  • 25
  • 44
profhoff
  • 1,017
  • 1
  • 13
  • 21

1 Answers1

0

Assuming that vectors is a pandas.DataFrame, you probably want this pattern:

from i, v in enumerate(vectors.itertuples()):
    if v.count>=50:
        ...
        ... v.word ...
Jus
  • 504
  • 3
  • 11