Say I have dataframe named population that contains the series age and education. I am interested in running the command pd.qcut so for example for age I would write pd.qcut(population.age.values, [0, .25, .5, .75, 1],['a','b','c','d']).
I would like to do this for each column (and replace each column) in a loop form, as:
col_name = ['age', 'education']
for i in col_name:
population.i=pd.qcut(population.i.values, [0, .25, .5, .75, 1],['a','b','c','d'])
But I cannot find the right function that opens the string for me in population.i.values. I tried Poped(i) but it didn't work.
Thanks in advance.