I have a pandas dataframe with binary value columns. I would like to replace values in each cell with its frequency in rspective column in place. My question is how to keep track of the current column while using apply on the subset of columns like here: (to be applied from 8th columns to the end) :
train_data.ix[:,8:] = train_data.ix[:,8:].apply(x: what should come here?)
I know that
train_data.ix[:,col_number].value_counts() will return number of zeros in col_number but how can I use it inside apply function?