I have a list
[[12, 6], [12, 0], [0, 6], [12, 0], [12, 0], [6, 0], [12, 6], [0, 6], [12, 0], [0, 6], [0, 6], [12, 0], [0, 6], [6, 0], [6, 0], [12, 0], [6, 0], [
IMHO, pandas offers a better solution for this "tabulation" problem:
One dimension:
my_tab = pd.crosstab(index = df["feature_you_r_interested_in"],
columns="count")
Proportion count:
my_tab/my_tab.sum()
Two-dimensions (with totals):
cross = pd.crosstab(index=df["feat1"],
columns=df["feat2"],
margins=True)
cross
Also, as mentioned by other coleagues, pandas value_counts method could be all you need. It is so good that you can have the counts as percentages if you want:
df['your feature'].value_counts(normalize=True)
I'm very grateful for this blog:
http://hamelg.blogspot.com.br/2015/11/python-for-data-analysis-part-19_17.html