Для этого вы можете использовать списочные выражения:
Вот примерный кадр данных:
import pandas as pd
df = pd.DataFrame({'one' : pd.Series([10, 0, 10, 9], index=['a', 'b', 'c', 'd']), //
'two' : pd.Series([0, 0, 10., 4.6], index=['a', 'b', 'c', 'd']), //
'three' : pd.Series(['aaa', 'abc', 'def', 'fff'], index=['a', 'b', 'c', 'd'])})
print(df)
"""
one two three
a 10 0.0 5
b 0 0.0 -1
c 10 10.0 7
d 9 4.6 -1
"""
Какие у меня типы столбцов?
for col in df.columns:
print('col : ',col, ' , datatype: ',df[col].dtype)
"""
col: one , datatype: int64
col: two , datatype: float64
col: three , datatype: object
"""
Возвращать столбцы типа'float'
print(df[[col for col in df.columns if df[col].dtype == 'float']])
"""
two
a 0.0
b 0.0
c 10.0
d 4.6
"""
Возвращать несколько типов столбцов (float и int64)
print(df[[col for col in df.columns if df[col].dtype in ['float','int64']]])
"""
one two
a 10 0.0
b 0 0.0
c 10 10.0
d 9 4.6
"""