python_libre_pythonista_ext icon indicating copy to clipboard operation
python_libre_pythonista_ext copied to clipboard

Boolean does not return True or False?

Open shantanuo opened this issue 10 months ago • 0 comments

I have pandas dataframe that looks like this...

Product	Dealer1	Dealer2	Dealer3	Dealer4	Actual
A	29	31	32	90	30

The dataframe is created successfully using...

df = lp("a1:f2", headers=True)

This works as expected. It simply adds 2 to all values.

anomalies = df.iloc[:, 1:-1].apply(lambda x: x + 2)

But this does not:

anomalies = df.iloc[:, 1:-1].apply(lambda x: x < 80)

It should return True, True, True, False because Dealer4 value is 90 that is greater than 80

shantanuo avatar Mar 28 '25 06:03 shantanuo