I have the following framework:
amount catcode cid cycle date di feccandid type 0 1000 E1600 N00029285 2014 2014-05-15 D H8TX22107 24K 1 5000 G4600 N00026722 2014 2013-10-22 D H4TX28046 24K 2 4 C2100 N00030676 2014 2014-03-26 D H0MO07113 24Z
I want to make dummy variables for the values ββin the type column. There are about 15. I tried this:
pd.get_dummies(df['type'])
And he returns this:
24A 24C 24E 24F 24K 24N 24P 24R 24Z date 2014-05-15 0 0 0 0 1 0 0 0 0 2013-10-22 0 0 0 0 1 0 0 0 0 2014-03-26 0 0 0 0 0 0 0 0 1
I would like to have a dummy variable column for each unique value in type
source share