Python Pandas Filter but results are inversed

Tags: ,



Hi I’ve built a filter where I expect the results to only show ‘New’. However the result shows everything but new?

filt = (export['jiraStatus'] == 'New')
print(export.loc[~filt])

Thoughts?

TIA

Neil

Answer

The ~ negates/inverts the filter. Just use .loc[filt] instead of .loc[~filt] to get the un-negated result.



Source: stackoverflow