# UnexpectedRowsExpectation in pandas dataframe

**URL:** <https://discourse.greatexpectations.io/t/unexpectedrowsexpectation-in-pandas-dataframe/2050>\
**Category:** GX Core Support\
**Tags:** how-to\
**Created:** [January 12, 2025, 3:56am UTC](https://discourse.greatexpectations.io/t/unexpectedrowsexpectation-in-pandas-dataframe/2050 "2025-01-12T03:56:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ragk](https://avatars.discourse-cdn.com/v4/letter/r/ac8455/32.png) [@ragk](https://discourse.greatexpectations.io/u/ragk)\
**Post date:** [January 12, 2025, 3:56am UTC](https://discourse.greatexpectations.io/t/unexpectedrowsexpectation-in-pandas-dataframe/2050/1 "2025-01-12T03:56:41Z")

</div>

How to run this on pandas dataframe? the below code not works.please help.  
class ExpectPassengerCountToBeLegal(gx.expectations.UnexpectedRowsExpectation):  
unexpected\_rows\_query: str = (  
“SELECT \* FROM {batch} WHERE passenger\_count \> 6 or passenger\_count \< 0”  
)
