The following code will print True because the Series contains at least one element that is greater than 1. However, it seems a little non-neat. Is there a more Pythonic way to return True if the series contains a number that is a value>
import pandas as pd s = pd.Series([0.5, 2]) print True in (s > 1)
True
EDIT: Not only is the above non-Pythonic answer, it sometimes returns an incorrect result for some reason. For instance:
s = pd.Series([0.5]) print True in (s < 1)
False
source share