![]() |
VOOZH | about |
In this article, we will see how to select columns with specific data types from a dataframe. This operation can be performed using the DataFrame.select_dtypes()method in pandas module.
Syntax: DataFrame.select_dtypes(include=None, exclude=None)
Parameters :
include, exclude : A selection of dtypes or strings to be included/excluded. At least one of these parameters must be supplied.
Return : The subset of the frame including the dtypes in include and excluding the dtypes in exclude.
Step-by-step Approach:
Output:
👁 ImageOutput:
👁 ImageBelow is the complete program based on the above approach:
Output:
👁 ImageExample:
Here we are going to extract columns of the below dataset:
Output:
👁 ImageNow, we are going to display all the columns having float64 as the data type.