Python
All Top Python Interview Questions#17
Isolate Numerical and Categorical Columns with select_dtypes in Pandas
EasyInterview Question #17
Given a mixed DataFrame of numerical, object, and datetime columns, select all numerical columns (int, float) for statistical scaling.
Input Table: df
1 rows preview| id | age | salary | signup_date | country |
|---|---|---|---|---|
| 1 | 25 | 65000.5 | 2026-01-01 | India |
Expected Output Structure1 rows
| id | age | salary |
|---|---|---|
| 1 | 25 | 65000.5 |
Interview Context
Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.
Python 3.10 (Pandas)
Environment Ready
Starting the real Python + pandas runtime (one-time download)…