0
$\begingroup$

I am working with real estate data for an ML/DL project. In the csv file there is a column in which each cell contains data like the examples below:

Karachi Houses > DHA Defence Houses > DHA Phase 6 Houses

Karachi Houses > DHA Defence Houses > DHA Phase 7 Houses

Karachi Houses > DHA Defence Houses > DHA Phase 8 Houses

Karachi Houses > DHA Defence Houses > DHA Phase 4 Houses

Karachi Houses > DHA Defence Houses > DHA Phase 5 Houses

Karachi Flats > DHA Defence Flats > DHA Phase 8 Flats > Emaar Crescent Bay Flats > Emaar Pearl Towers Flats

Karachi Flats > DHA Defence Flats > DHA Phase 2 Extension Flats

Karachi Flats > DHA Defence Flats > DHA Phase 8 Flats > Emaar Crescent Bay Flats

Karachi Flats > DHA Defence Flats > DHA Phase 7 Flats > Jami Commercial Area Flats

Karachi Houses > DHA Defence Houses > DHA Phase 7 Extension Houses

Karachi Flats > DHA Defence Flats > DHA Phase 6 Flats > Nishat Commercial Area Flats

It basically tells where in where in where in where a particular property is located. The objective is to create a price prediction model. I think I can do something with this particular column (maybe classify it somehow) to be able to use it. But because the data might have 3 layers, or 4 or 5 or maybe more, I can't figure out the right way to make it numerical to for example implement a decision tree or random forest. Any guidance?

$\endgroup$

1 Answer 1

0
$\begingroup$

You can create a new column for each layer of location, such as city, area, phase, and tower/building. Then, split the data in the original column by the ">" symbol and assign each layer to its corresponding new column. For the properties with less than five layers, you can assign NaN values to the rest of the layers. After that, you can encode the categorical data using one-hot encoding or label encoding to make it numerical. This will enable you to use the new columns as features for your ML/DL model.

$\endgroup$
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.