title: Name pandas dataframe based on the output of Groupby-function
body: <p>I have a dataset that consists of all the shots taken in a large number of football competitions for a number of seasons. I wrote the following script to make subsets for each competition and corresponding season.</p>
  
  <pre><code>import pandas as pd
  import csv
  shots = pd.read_csv("C:/Users/HJA/Desktop/Betting/understatV0.01/shots.csv", encoding='iso-8859-1')
  
  shots_premier_league = shots.groupby(['Competition']).get_group('Premier_League')
  shots_bundesliga = shots.groupby(['Competition']).get_group('Bundesliga')
  shots_la_liga = shots.groupby(['Competition']).get_group('La_Liga')
  shots_ligue_1 = shots.groupby(['Competition']).get_group('Ligue_1')
  shots_serie_a = shots.groupby(['Competition']).get_group('Serie_A')
  </code></pre>
  
  <p>Everything goes fine until this point. However, now I want to subdivide each competition in samples for each season. I use the following script (in this case I use as example the Premier League:</p>
  
  <pre><code>shots_premier_league_2014 = shots_premier_league.groupby(['Season']).get_group('2014')
  shots_premier_league_2015 = shots_premier_league.groupby(['Season']).get_group('2015')
  shots_premier_league_2016 = shots_premier_league.groupby(['Season']).get_group('2016')
  shots_premier_league_2017 = shots_premier_league.groupby(['Season']).get_group('2017')
  shots_premier_league_2018 = shots_premier_league.groupby(['Season']).get_group('2018')
  </code></pre>
  
  <p>This result in the following error: <a href="https://i.stack.imgur.com/Zazsd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Zazsd.jpg" alt="enter image description here"></a></p>
  
  <p>I am 100% sure that 2014 is an actual value. In addition, how can I write a function that automatically includes the <em>competition</em> and <em>season</em> in the name of the pandas dataframe?</p>