Jan-30-2020, 04:16 PM
So my normal method for creating a table produces EITHER frequencies OR percentages.
I would really like to produce both frequencies AND percentages in the same table.
My code for the frequency tables is:
I would really like to produce both frequencies AND percentages in the same table.
My code for the frequency tables is:
tab001 = pd.crosstab(data[my_list[13]].\ map(meta.variable_value_labels[my_list[13]]), \ data['qdp2'].map(meta.variable_value_labels['qdp2']), \ dropna=True, margins=True). \ loc[meta.variable_value_labels[my_list[13]].values()]. \ loc[:,meta.variable_value_labels['qdp2'].values()].round(4)To produce percentages i use the same code but add:
, normalize= 'columns'Any help with getting frequencies and percentages in the same table would be appreciated.