Answers for "using df.astype to select categorical data and numerical data"

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 "using df.astype to select categorical data and numerical data"

Python Answers by Framework

Browse Popular Code Answers by Language