0
0
WSWyx Smrf
The code first selects all of the dataframe's dtypes using the select_dtypes() function. The include and exclude values passed to this function specify which data types the code should select. In this case, the code only wants to select the dataframe's number data type.
Next, the code uses the select_dtypes() function to create a new dataframe called df_numeric. This dataframe will only contain the data type of number.
Finally, the code uses the select_dtypes() function to create a new dataframe called df_non_numeric. This dataframe will only contain the data type of non-number.
import numpy as np
import pandas as pd
# Returns numbers dataframe
df_numeric = df.select_dtypes(include=[np.number])
# Returns text dataframe
df_non_numeric = df.select_dtypes(exclude=[np.number])