dtypes is an attribute, not a method, returning a Series indexed by column name, with each value being that column's dtype — int64 for whole numbers, float64 for decimals, object for text, or genuinely mixed-type data, datetime64 for dates, and so on. It's the standard way to check whether a column ended up with the type you expect after loading or transforming data, since a column you expect to be numeric silently ending up as object usually signals a data-quality problem, like an unexpected non-numeric value mixed in.
1Understanding df.dtypes
dtypes is an attribute, not a method, returning a Series indexed by column name, with each value being that column's dtype — int64 for whole numbers, float64 for decimals, object for text, or genuinely mixed-type data, datetime64 for dates, and so on. It's the standard way to check whether a column ended up with the type you expect after loading or transforming data, since a column you expect to be numeric silently ending up as object usually signals a data-quality problem, like an unexpected non-numeric value mixed in.
A numeric column unexpectedly showing dtype 'object' is a strong signal that it contains at least one non-numeric value somewhere — pandas falls back to the generic object dtype whenever a column can't be cleanly represented as a single numeric type.
import pandas as pd
df = pd.DataFrame({"id": [1, 2, 3], "price": [9.99, 19.99, 29.99], "name": ["a", "b", "c"]})
print(df.dtypes)2Practical Example
Here is a real-world application of df.dtypes showing how it is used in production Pandas code.
import pandas as pd
df = pd.DataFrame({"quantity": [1, 2, "three"]})
print(df.dtypes)3Best Practices
Follow these guidelines when working with df.dtypes:
1. Check df.dtypes right after loading data to confirm columns have the expected types, especially numeric and date columns
2. Investigate immediately if a column you expect to be numeric shows dtype 'object' — it usually means a stray non-numeric value is mixed into that column
3. Use df.astype() to explicitly convert a column's dtype once you've identified and cleaned up the underlying data issue
Tip: A numeric column unexpectedly showing dtype 'object' is a strong signal that it contains at least one non-numeric value somewhere — pandas falls back to the generic object dtype whenever a column can't be cleanly represented as a single numeric type.
import pandas as pd
df = pd.DataFrame({"id": [1, 2, 3], "price": [9.99, 19.99, 29.99], "name": ["a", "b", "c"]})
print(df.dtypes)