Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Unable to form categorical groups

$
0
0

@ASHISH_17 wrote:

I am unable to convert continuous data into categorical data.
Below is the snippet -

train.loc[train[‘income_spend’]<=0.5,‘income_spend’]=0
train.loc[(train[‘income_spend’]>0.5) & (train[‘income_spend’]<=1.0),‘income_spend’]=1
train.loc[(train[‘income_spend’]>1.0) & (train[‘income_spend’]<=1.5),‘income_spend’]=2
train.loc[(train[‘income_spend’]>1.5) & (train[‘income_spend’]<=2.5),‘income_spend’]=3
train.loc[train[‘income_spend’]>2.5,‘income_spend’]=4

On checking the value counts, group 0 and 1 are properly formed but rest all entries merged into group 4.

Same is the problem with 2 other features as well.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles