dic = {}
for g in ['male', 'female']:
    dic[g] = defaultdict(dict)
for y in [2013, 2014]:
    dic[g][y] = df[(df[Gender] == g) & (df[Year] == y)]
how do you filter pandas dataframes by multiple columns