Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get_dummies

#this do dummie verable do a very intersting thing they turn calegorical 
#variables in numerical like M and F they can 0 for M and 1 for F  


pd.get_dummies(df.Gender)

	F	M
0	0	1
1	1	0
2	1	0
3	0	1
4	1	0
...	...	...
202	1	0
203	0	1
204	0	1
205	0	1
206	1	0
207 rows × 2 columns

Comment

pd.get_dummies

>>> s = pd.Series(list('abca'))

>>> pd.get_dummies(s)
   a  b  c
0  1  0  0
1  0  1  0
2  0  0  1
3  1  0  0
Comment

PREVIOUS NEXT
Code Example
Python :: python dict setdefault 
Python :: matplotlib animate 
Python :: how to check if an element is in a list python 
Python :: python check if list contains 
Python :: bot ping command 
Python :: Making a txt file then write 
Python :: how to install pyinstaller 
Python :: python 3.8.5 download 32 bit 
Python :: how to execute a python file from another python file 
Python :: Python Roman to Integer method 2 
Python :: split a string into N equal parts. 
Python :: python shuffle array 
Python :: python check if there is internet connection 
Python :: sqlalchemy one to many 
Python :: Find All Occurrences of a Substring in a String in Python 
Python :: is python good for web development 
Python :: draw circle pygame 
Python :: python array colon 
Python :: read a file python 
Python :: pandas description of dataframe 
Python :: how to unlist a list in python 
Python :: create python list 
Python :: how to assign a new value in a column in pandas dataframe 
Python :: how to take date as input in python 
Python :: match statement 
Python :: python strip 
Python :: get last 3 elements in a list python 
Python :: pandas excel sheet name 
Python :: python iterate through objects attributes 
Python :: selenium element_to_be_clickable PYTHON 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =