Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python convert dataframe target to numbers

df.target_column_name = pd.Categorical(df.target_column_name)
df[target_column_name] = df.target_column_name.cat.codes
Comment

PREVIOUS NEXT
Code Example
Python :: empty python 
Python :: vortex identification 
Python :: python create empty list with size 
Python :: python multi dimensional dict 
Python :: automate ms word with python 
Python :: install python glob module in MacOS using pip 
Python :: build numpy array 
Python :: apropos, help 
Python :: apply WEKA filter on customer dataset 
Python :: Python NumPy atleast_2d Function Example 
Python :: Python NumPy copyto function example copy elements from a source array to a destination array. 
Python :: regex re speed 
Python :: python generate string of length 
Python :: Python NumPy asarray_chkfinite Function Example Raises Value Error 
Python :: django on-delete options 
Python :: Python NumPy tile Function Example Working with 1D array 
Python :: if statment with logical or operator for multiple varaibles 
Python :: split() without argument 
Python :: calculate mse loss python 
Python :: NumPy invert Code When the input is an array 
Python :: Printing a long code line to span over multiple lines 
Python :: fibo_itrativ 
Python :: Remove Brackets from List Using for loop 
Python :: Visual Studio Code pylint: Error when all is ok 
Python :: python extract multiple values from a single cell in a dataframe column using pandas 
Python :: map function in pyhton 
Python :: python list len 
Python :: cuenta atras segundero python 
Python :: OddOccurrencesInArray 
Python :: ring Access List Items by String Index 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =