title: How to split data in a dataframe cell and perform a Pandas groupby on splits?
body: <p>I have produced some data which lists parks in proximity to different areas of East London with use of the FourSquare API. It here in the dataframe, df. </p>
  
  <pre><code>Location,Parks,Borough
  Aldborough Hatch,Fairlop Waters Country Park,Redbridge
  Ardleigh Green,Haynes Park,Havering
  Bethnal Green,"Haggerston Park, Weavers Fields",Tower Hamlets
  Bromley-by-Bow,"Rounton Park, Grove Hall Park",Tower Hamlets
  Cambridge Heath,"Haggerston Park, London Fields",Tower Hamlets
  Dalston,"Haggerston Park, London Fields",Hackney
  </code></pre>
  
  <p>Import data with <code>df = pd.read_clipboard(sep=',')</code></p>
  
  <p>What I would like to do is group by the borough column and count the distinct parks in that borough so that for example 'Tower Hamlets' = 5 and 'Hackney' = 2. I will create a new dataframe for this purpose which simply lists total number of parks for each borough present in the dataframe. </p>
  
  <p>I know I can do:</p>
  
  <pre><code>df.groupby(['Borough', 'Parks']).size()
  </code></pre>
  
  <p>But I need to split parks by the delimiter ',' such that they are treated as unique, distinct entities for a borough.</p>
  
  <p>What do you suggest?</p>
  
  <p>Thanks!</p>