title: how to groupby two columns and words counts last columns in pandas(or python)
body: <p>1) For example, I have 3 columns like below </p>
  
  <pre><code> date      categories     contents  
   2018-01   fish_tank1     Goldfish Gombessa Goosefish Gopher rockfish   
   2018-01   fish_tank2     Grass carp Goosefish Grayling mullet shark  
   2018-02   fish_tank2     Goosefish Gopher rockfish Grayling mullet shark  
   2018-01   fish_tank1     carp Goosefish Grayling Goldfish Gombessa   
   2018-02   fish_tank2     carp Goosefish Grayling Grass carp Goosefish  
   2018-03   fish_tank3     Grass carp Goosefish Grayling mullet shark  
   2018-03   fish_tank2     Goosefish Gopher rockfish Goosefish Grayling  
  </code></pre>
  
  <p>2) I sort of would like to do <code>df.groupby(['date','categories']).agg(df.contents.str.split(expand=True).stack().value_counts()</code> to get similar like below results. but I cannot figure this out last few days. </p>
  
  <pre><code>    date   categories       contents  
   2018-01   fish_tank1  2    Goldfish    2   
                              Gombessa    2   
                              Goosefish   2    
                              Gopher      1   
                              rockfish    1   
                              ......   
             fish_tank2      Grass    1   
                             carp     1   
                             .....  
   2018-02   fish_tank2     Goosefish    3  
                            Grayling     2  
                            Gopher       1  
                            ........    
  ........................  
  </code></pre>
  
  <p>3) Could anyone give me the insight to get the result what I would like to do? </p>