I\'m making some crosstabs with pandas:
a = np.array([\'foo\', \'foo\', \'foo\', \'bar\', \'bar\', \'foo\', \'foo\'], dtype=object)
b = np.array([\'one\', \'one\
The crosstab function has a parameter called dropna which is set to True by default. This parameter defines whether empty columns (such as the one-shiny column) should be displayed or not.
I tried calling the funcion like this:
pd.crosstab(a, [b, c], rownames=['a'], colnames=['b', 'c'], dropna = False)
and this is what I got:
b one two
c dull shiny dull shiny
a
bar 1 0 1 0
foo 2 0 1 2
Hope that was still helpful.