I was wondering if there is an elegant and shorthand way in Pandas DataFrames to select columns by data type (dtype). i.e. Select only int64 columns from a DataFrame.
<Multiple includes for selecting columns with list of types for example- float64 and int64
df_numeric = df.select_dtypes(include=[np.float64,np.int64])
You can use :
for i in x.columns[x.dtypes == 'object']: print(i)
incase you just want to display only the column names of a particular dataframe rather than a sliced dataframe. Don't know if any function as such exits for python.
PS : replace object
with the datatype you want.
select_dtypes(include=[np.int])