Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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
Comment

select data frame with categorical datatype in pandas

how to select pandas dataframe with categorical datatype
Comment

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
Comment

select data frame with categorical datatype in pandas

how to select pandas dataframe with categorical datatype
Comment

PREVIOUS NEXT
Code Example
Python :: fastapi json request 
Python :: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable 
Python :: integer colomn to datetime pandas python 
Python :: pandas select columns by index list 
Python :: pandas export csv without index 
Python :: draw bounding box on image python opencv 
Python :: python how to check if first character in string is number 
Python :: import error in same directory python 
Python :: pandas count number missing values 
Python :: view(-1) in pytorch 
Python :: python scatter plot legend 
Python :: shebang python 
Python :: django media root 
Python :: np vstack 
Python :: Permission denied in terminal for running python files 
Python :: python get desktop directory 
Python :: python count multiple characters in string 
Python :: circumference of circle 
Python :: python verzeichnis erstellen 
Python :: python iterate through files in directory 
Python :: pyautogui press 
Python :: pandas iterrows 
Python :: converting int to binary python 
Python :: python sleep 1 second 
Python :: pip tensorflow 
Python :: python checking if something is equal to NaN 
Python :: how to calculate sum of a list in python 
Python :: python read entire file 
Python :: remove string punctuation python 3 
Python :: convert dictionary keys/values to lowercase in python 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =