sio = StringIO(table)
df = pd.read_table(sio, sep='\\s+', parse_dates=['dt'])
df.set_index('dt', inplace=True)
pd.crosstab(df.A > 0, df.B > 0)
Is there a pythonic way to do a contingency table in Pandas?