I am trying to create new columns based on the values of the column.
| row_index | value | new_column |
|---|---|---|
| 128 | Server | Device Type |
| 512 | Server | Device Type |
| 512 | FMCG | Business |
| 1024 | CentOS | Device Type |
| 2048 | CentOS | Device Type |
| 1024 | Online | Business |
| 2048 | Offline | Business |
| 128 | ECommerce | Business |
TO THIS:
| row_index | DeviceType | Business |
|---|---|---|
| 128 | Server | Ecommerce |
| 512 | Server | FMCG |
| 1024 | CentOS | Online |
| 2048 | CentOS | Offline |
I have tries to do this
pd.get_dummies(df.New)
but it is returning result in 0 and 1 also dropping the row_index column.