Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Pandas · Module

df.dtypes

DataFrame.dtypes is a property that returns a Series describing the dtype of every column. The Series uses the DataFrame’s column labels as its index.

How it works

Accessing DataFrame.dtypes produces a Series that maps every column label to that column’s data type. The Series keeps the DataFrame’s column labels as its index, making it useful for inspecting schema before selecting, converting, or validating columns.

Syntax

DataFrame.dtypes

Returns

pandas.Series — the data type of each column.

Key points

  • The property reports the data type associated with each DataFrame column.
  • The result is a pandas Series rather than a scalar or mapping.
  • Column labels become the index of the returned Series, preserving their correspondence.
  • The Series values describe individual column dtypes, such as integer, floating-point, datetime, or string types.
  • Series.dtypes is a related reference for inspecting the dtype object underlying a Series.

Common mistakes

  • A column containing mixed Python value types is represented with the object dtype, so object does not necessarily mean the values are strings.

Example: Inspect column dtypes

import pandas as pd

frame = pd.DataFrame({
    "price": [1.5, 2.0],
    "count": [1, 2],
    "label": ["a", "b"],
})

print(frame.dtypes)

Creates a heterogeneous DataFrame and prints the dtype associated with each column.

When to use it

Schema inspection

Before cleaning or validation, inspect the table schema to find columns whose types need attention.

Type-aware preprocessing

Use the reported types to decide which columns need conversion or specialized processing.

Detect mixed values

Review mixed-type columns that may have been inferred as object.

Interview questions

QWhat does DataFrame.dtypes return?

DataFrame.dtypes is a property, so it is accessed without parentheses. It returns a pandas Series whose values are the dtypes of the DataFrame’s columns and whose index is the original column index.

Follow-up: How would you use the result to select columns by type? Use DataFrame.select_dtypes, which filters columns according to include and exclude dtype criteria.

QHow is the returned Series aligned with the DataFrame?

Each output Series entry corresponds to one DataFrame column. The Series index contains the DataFrame’s original column labels, while its values describe the respective column types.

Follow-up: What happens when a column contains mixed types? The documentation says such columns are stored with the object dtype.

QWhy inspect DataFrame.dtypes before transforming data?

It is useful for examining a heterogeneous table before type-dependent processing, such as identifying numeric, temporal, or object-typed columns. It reports the inferred or assigned dtype currently held by each column.

Follow-up: How can types be changed? DataFrame.astype casts a pandas object to a specified dtype, while DataFrame.convert_dtypes converts columns to suitable dtypes supporting pd.NA.

  • Series.dtypes
  • DataFrame.select_dtypes
  • DataFrame.astype
  • DataFrame.convert_dtypes

Source: pandas.DataFrame.dtypes. Checked 2026-10-15.