How to find the count of only numeric columns in Pandas DataFrame?

How to find the count of only numeric columns in Pandas DataFrame?

Often times we have 100+ columns in the dataset and we have to find out how many columns are numeric and ultimately count of the columns

numerics = ['int16', 'int32', 'int64', 'float16', 'float32', 'float64']
numeric_df = df.select_dtypes(include=numerics)
len(numeric_df.columns)

Here, the first line creates a list of all the data types having numeric values and saves them into a variable called numerics

then numeric_df variable stores column for elements stated in numerics variable.

Simply, in the last, we are using the simple len function to calculate the number of columns.