0

Here's the example:

# Suppose you have this dictionary
di = {1:0.2 , 4:0.6 , 3:0.98 , 2:0.98}

# and Now create a DataFrame from the dictionary
di = pd.DataFrame.from_dict(di,orient='index')

# Now i want to count valuse in the DataFrame that are more than 0.8 or less than 0.4
## Here is what i wrote
len(   di[di[0]>0.8 or di[0]<0.4]   )

But i got this error:

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

So how can i handle it?
Thanks for Your help!

Shayan
  • 5,165
  • 4
  • 16
  • 45

0 Answers0