Answers for "get categorical features pandas"

1

python dataframe get numeric columns

dfnew = df.select_dtypes(include=np.number)
Posted by: Guest on November-19-2020
1

using df.astype to select categorical data and numerical data

df = pd.DataFrame({'vertebrates': ['Bird', 'Bird', 'Mammal', 'Fish', 'Amphibian', 'Reptile', 'Mammal']})

df.vertebrates.astype("category").cat.codes
Posted by: Guest on June-01-2020

Code answers related to "get categorical features pandas"

Python Answers by Framework

Browse Popular Code Answers by Language