df.dtypes
returns a Series
with each column name as index and the dtype as value. When pandas displays Series is also displays the overall type of the Series below it, which is what you see here (as type
are objects
).
This is the value of df.dtypes.dtype
.
Example:
Why there is an extra line in the display
pd.Series([1, 2, 3])
0 1 # this is the Series data
1 2 #
2 3 #
dtype: int64 # this is just for display to indicate the Series type
Why the dtype is object
df = pd.DataFrame({'A': [1], 'B': [True], 'C': ['a']})
df.dtypes
A int64
B bool
C object
dtype: object # this just indicates that we have a Series of python objects