Sunday, April 5, 2020

Answer for converting Categorical data to numerical.

https://365datascience.com/dwqa-answer/answer-for-converting-categorical-data-to-numerical/ -

Hi Ganesh, 

one approach would be to do a mapping of the variables in the form of dictionary, like you suggested unemployed becomes 0, etc. :


dict = {"occupation": "unemployed": 1, ...


Then you can use the replace() method on your data frame to directly assign the new values:


your_data.replace(dict, inplace=True)

Here’s a link with more on the topic:
https://pbpython.com/categorical-encoding.html

 

Best, 

Eli




#365datascience #DataScience #data #science #365datascience #BigData #tutorial #infographic #career #salary #education #howto #scientist #engineer #course #engineer #MachineLearning #machine #learning #certificate #udemy

No comments:

Post a Comment