I've been locked out for days trying to create a new categorical variable from the aggregation of values from a sequential variable. I'm migrating syntax scripts from SPSS to Python using Pandas In SPSS I used the following command to do what I need:
RECODE QTD_FTE_RAZAO (0=5) (1 thru 3000 = 0) (3000.01 thru 4000 = 1) (4000.01 thru 5000 = 2) (5000.01 thru 10000 = 3) (10000.01 thru 15000 = 4) (15000.01 thru 9999999999 = 5)
INTO COD_FTE_RAZAO.
EXECUTE.
I looked at the pandas cut function, but it doesn't work because it creates text objects and I honestly couldn't write the parameters I need.
I need to turn it into values because I will create an index. I will create 5 variable categories and in the end I will add the values and create an index. That's why I need to turn these ranges into numbers.
The easiest way to do this would be to do a function?
I'm completely lost, could someone help me please?