To extract numeric types from Pandas DataFrame, Use select_types method . DataFrame.select_dtypes(include=None, exclude=None) import numpy as np import pandas as pd df = pd.DataFrame({'a': [1, 2] * 3, 'b': [True, False] * 3, 'c': [1.0, 2.0] * 3, 'd': ['one','two'] * 3}) To select all numeric types, set the parameter 'include' to np.number or 'number'. df.select_dtypes(include='number') df.select_dtypes(include=np.number) a c 0 1 1.0 1 2 2.0 2 1 1.0 3 2 2.0 4 1 1.0 5 2 2.0 You can also use the Python built-in types such as int and float, or 'int' and 'float' as string. df.select_dtypes(include=int) df.select_dtypes(include='int') a 0 1 1 2 2 1 3 2 4 1 5 2 df.select_dtypes(include=float) df.select_dtypes(include='float') c 0 1.0 1 2.0 2 1.0 3 2.0 4 1.0 5 2.0 To select strings you...
I am a pythoner since 2020. I will write here my dairy about python, my hobby, and...