# Expect\_column\_values\_to\_be\_of\_type for dtype=object

**URL:** <https://discourse.greatexpectations.io/t/expect-column-values-to-be-of-type-for-dtype-object/579>\
**Category:** Archive\
**Tags:** how-to\
**Created:** [January 4, 2021, 11:10am UTC](https://discourse.greatexpectations.io/t/expect-column-values-to-be-of-type-for-dtype-object/579 "2021-01-04T11:10:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonlu](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jasonlu](https://discourse.greatexpectations.io/u/jasonlu)\
**Post date:** [January 4, 2021, 11:10am UTC](https://discourse.greatexpectations.io/t/expect-column-values-to-be-of-type-for-dtype-object/579/1 "2021-01-04T11:10:05Z")

</div>

For the integer column been automatically inferred as dtype object, how to check its actual data type Int64?

when I check with int, 18% are failing

`batch.expect_column_values_to_be_of_type(column="departmentId", type_="int")`

> ```
> {
> "success": false,
> "result": {
> "element_count": 29987,
> "missing_count": 0,
> "missing_percent": 0.0,
> "unexpected_count": 5411,
> "unexpected_percent": 18.044485943909027,
> "unexpected_percent_nonmissing": 18.044485943909027,
> "partial_unexpected_list": [
> "288",
> "288",
> "288",
> "288",
> "288",
> "288",
> "288",
> "288",
> "288",
> "288",
> "288",
> "288",
> "288",
> "288",
> "288",
> "288",
> "288",
> "288",
> "288",
> "288"
> ]
> },
> "meta": {},
> "exception_info": null
> }
> 
> ```

when I check with int64, 100% failed

> batch.expect\_column\_values\_to\_be\_of\_type(column=“departmentId”, type\_=“int64”)

> ```
> {
> "success": false,
> "result": {
> "element_count": 29987,
> "missing_count": 0,
> "missing_percent": 0.0,
> "unexpected_count": 29987,
> "unexpected_percent": 100.0,
> "unexpected_percent_nonmissing": 100.0,
> "partial_unexpected_list": [
> 287,
> 288,
> 287,
> 287,
> 288,
> 288,
> 287,
> 287,
> 288,
> 288,
> 288,
> 288,
> 288,
> 288,
> 288,
> 288,
> 288,
> 288,
> 288,
> 288
> ]
> },
> "meta": {},
> "exception_info": null
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![eugene.mandel](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/eugene.mandel/32/22_2.png) [@eugene.mandel](https://discourse.greatexpectations.io/u/eugene.mandel)\
**Post date:** [January 11, 2021, 4:02am UTC](https://discourse.greatexpectations.io/t/expect-column-values-to-be-of-type-for-dtype-object/579/2 "2021-01-11T04:02:58Z")

</div>

You can use a related expectation [expect\_column\_values\_to\_be\_in\_type\_list](https://docs.greatexpectations.io/en/latest/autoapi/great_expectations/dataset/dataset/index.html#great_expectations.dataset.dataset.Dataset.expect_column_values_to_be_in_type_list) that allows to specify a list of types instead of one type.

---

<div class="post-metadata">

**Author:** ![jasonlu](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jasonlu](https://discourse.greatexpectations.io/u/jasonlu)\
**Post date:** [April 16, 2021, 3:52am UTC](https://discourse.greatexpectations.io/t/expect-column-values-to-be-of-type-for-dtype-object/579/3 "2021-04-16T03:52:58Z")

</div>

Thanks, we realize for a Str column, we are ending up with below expectation.

`expect_column_values_to_be_in_type_list(column="test_col", type_list=["str","float64","int64"])`

Is that what’s recommended? Although it’s a str column but some small dataset are having int/float values only, I was expecting it to be successful if we are checking type str ONLY as int can be parsed into str?

---

<div class="post-metadata">

**Author:** ![eugene.mandel](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/eugene.mandel/32/22_2.png) [@eugene.mandel](https://discourse.greatexpectations.io/u/eugene.mandel)\
**Post date:** [April 19, 2021, 9:44pm UTC](https://discourse.greatexpectations.io/t/expect-column-values-to-be-of-type-for-dtype-object/579/4 "2021-04-19T21:44:12Z")

</div>

@jasonlu This expectation checks “storage types” - types the storage engine (e.g., a database or Pandas) uses to store the data. Yes, verifying against a list of types is recommended in this case.

---

<div class="post-metadata">

**Author:** ![jasonlu](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jasonlu](https://discourse.greatexpectations.io/u/jasonlu)\
**Post date:** [April 20, 2021, 3:20am UTC](https://discourse.greatexpectations.io/t/expect-column-values-to-be-of-type-for-dtype-object/579/5 "2021-04-20T03:20:36Z")

</div>

thanks @eugene.mandel
