# Expectation to confirm that all values in column are the same as in a list

**URL:** <https://discourse.greatexpectations.io/t/expectation-to-confirm-that-all-values-in-column-are-the-same-as-in-a-list/1577>\
**Category:** GX Core Support\
**Tags:** how-to, help-wanted\
**Created:** [January 12, 2024, 4:11pm UTC](https://discourse.greatexpectations.io/t/expectation-to-confirm-that-all-values-in-column-are-the-same-as-in-a-list/1577 "2024-01-12T16:11:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Antony](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@Antony](https://discourse.greatexpectations.io/u/Antony)\
**Post date:** [January 12, 2024, 4:11pm UTC](https://discourse.greatexpectations.io/t/expectation-to-confirm-that-all-values-in-column-are-the-same-as-in-a-list/1577/1 "2024-01-12T16:11:29Z")

</div>

Hi everyone,  
I wanted to compare whether all the values (including duplicates and their count as well) in my column are the same as in the list, but I couldn’t do it using expect\_column\_values\_to\_be\_in\_set - there was a problem that it only checks for unique values, so I couldn’t confirm for sure that all the values in this column are identical to the values in the list including duplicates and counts = (

Conditionally, if I have the value ‘2023-10-10’ in the list of 3, and 4 in the column of such values, then the exception will be defined as correct, which does not correspond to what I want to achieve. For me to determine the exception as successful, their number should also match.

Part of my code in which i got expected\_values and created that expectation with expect\_column\_values\_to\_be\_in\_set:

expected\_values = [str(pd.to\_datetime(val).date()) for val in df[‘post\_time’] if pd.notnull(val)]

expectation\_configuration\_partition\_date\_matches\_post\_time = ExpectationConfiguration(  
expectation\_type=“expect\_column\_values\_to\_be\_in\_set”,  
kwargs={  
“column”: “partition\_date”,  
“value\_set”: expected\_values,  
“result\_format”: “COMPLETE”  
},  
meta={  
“notes”: {  
“format”: “markdown”,  
“content”: "Confirm that all values in the [partition\_date] column match the transformed values from the "  
“[post\_time] column, while also handling missing values and duplicates.”  
“ **Markdown** `Supported`”,  
}  
},  
)

suite.add\_expectation(expectation\_configuration=expectation\_configuration\_partition\_date\_matches\_post\_time)

context.add\_or\_update\_expectation\_suite(expectation\_suite=suite)

Can anyone tell me what the problem is or advise a ready-made solution for this exception?
