“get_dummy” Kod odpowiedzi

Uzyskanie manekinów i wprowadzanie ich do PandaS DataFrame

note:
dummies = pd.get_dummies(df[['column_1']], drop_first=True)
df = pd.concat([df.drop(['column_1'],axis=1), dummies],axis=1)


note:for more that one coloum keep ading in the list 
dummies = pd.get_dummies(df[['column_1', 'column_2','column_3']], drop_first=True)
df = pd.concat([df.drop(['column_1', 'column_1'],axis=1), dummies],axis=1)
JAKKA9

Uzyskanie manekinów dla kolumny w PandaS DataFrame

note:
dummies = pd.get_dummies(df[['column_1']], drop_first=True)

note:for more that one coloum keep ading in the list 
dummies = pd.get_dummies(df[['column_1', 'column_2','column_3']], drop_first=True)
JAKKA9

get_dummy

#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

Kristi

Odpowiedzi podobne do “get_dummy”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu