select_dtypes: Return a subset of a DataFrame including/excluding columns based on their dtype

select_dtypes: Return a subset of a DataFrame including/excluding columns based on their dtype

You might want to apply different kinds of processing to categorical and numerical features. Instead of manually choosing categorical features or numerical features, ask your pandas DataFrame to select them for you by using df.select_dtypes('data_type').

In the example above, you can either include or exclude certain data types using exclude.

Search

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran