The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

converting Categorical data to numerical.

converting Categorical data to numerical.

0
Votes
1
Answer

How to convert Categorical data into numerical in python? as you already converted in segmentation data
for example, unemployed=0
                         employed=1
                    Highly skilled=2

1 Answer

365 Team
0
Votes

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

×
Online Data Science Training
SAVE 60%