C Lang/machine learing
6-7. categorial data handling(one hot encoding, get_dummies, data binning, pd.cut,
iliosncelini
2019. 3. 24. 13:48




Out[60]:
| source | target | weight | color | weight_sign |
|---|
| 0 | 0 | 2 | 3 | red | M |
|---|
| 1 | 1 | 2 | 4 | blue | L |
|---|
| 2 | 2 | 3 | 5 | blue | XL |
|---|
Out[48]:
| source | target | weight | color_blue | color_red | weight_sign_L | weight_sign_M | weight_sign_XL |
|---|
| 0 | 0 | 2 | 3 | 0 | 1 | 0 | 1 | 0 |
|---|
| 1 | 1 | 2 | 4 | 1 | 0 | 1 | 0 | 0 |
|---|
| 2 | 2 | 3 | 5 | 1 | 0 | 0 | 0 | 1 |
|---|



| regiment | company | name | preTestScore | postTestScore |
|---|
| 0 | Nighthawks | 1st | Miller | 4 | 25 |
|---|
| 1 | Nighthawks | 1st | Jacobson | 24 | 94 |
|---|
| 2 | Nighthawks | 2nd | Ali | 31 | 57 |
|---|
| 3 | Nighthawks | 2nd | Milner | 2 | 62 |
|---|
| 4 | Dragoons | 1st | Cooze | 3 | 70 |
|---|
| 5 | Dragoons | 1st | Jacon | 4 | 25 |
|---|
| 6 | Dragoons | 2nd | Ryaner | 24 | 94 |
|---|
| 7 | Dragoons | 2nd | Sone | 31 | 57 |
|---|
| 8 | Scouts | 1st | Sloan | 2 | 62 |
|---|
| 9 | Scouts | 1st | Piger | 3 | 70 |
|---|
| 10 | Scouts | 2nd | Riani | 2 | 62 |
|---|
| 11 | Scouts | 2nd | Ali | 3 | 70 |
|---|
Out[76]:
0 Low
1 Great
2 Good
3 Good
4 Good
5 Low
6 Great
7 Good
8 Good
9 Good
10 Good
11 Good
Name: postTestScore, dtype: category
Categories (4, object): [Low < Okay < Good < Great]




