title: Dataframe and loops and lists
body: <p>I wanted to know if there is a more concise way to write the code below. I basically have a dataframe with three columns: &quot;Dates&quot;, &quot;Ramp_1&quot;, &quot;Ramp_2&quot;. My goal is to separate the data (Ramp_1 and Ramp_2) by month. The dates contain multiple years of data in this form: %Y-%m-%d %H:%M. I created a new column with only the months and then I used df.loc to create new dataframes:</p>
  <pre><code>mon=['jan','feb','mar','apr', 'may', 'jun','jul','aug','sep','oct','nov','dec']
  for i in range(len(mon)):
      mon[i] = df.loc[df[&quot;month&quot;]==(i+1), [&quot;Ramp_1&quot;,&quot;Ramp_2&quot;]]
  </code></pre>
  <p>I wanted to create 12 new dataframes with each one named after a month. Instead of doing that, I ended up creating a list of dataframes. So I manually wrote the   code like this:</p>
  <pre><code>jan=mon[0]
  feb=mon[1]
  mar=mon[2]
  apr=mon[3]
  may=mon[4]
  jun=mon[5]
  jul=mon[6]
  aug=mon[7]
  sep=mon[8]
  octo=mon[9]
  nov=mon[10]
  dec=mon[11]
  </code></pre>
  <p>My question is: is there a more concise way to write this? I know there is, but i haven't been able to figure it out!</p>
  <p>I also tried doing this:</p>
  <pre><code>mon=['jan','feb','mar','apr', 'may', 'jun','jul','aug','sep','oct','nov','dec']
  for i in range(len(mon)):
      name = mon[i]
      name = df.loc[df[&quot;month&quot;]==(i+1), [&quot;Ramp_1&quot;,&quot;Ramp_2&quot;]]
  </code></pre>
  <p>sample of my data:</p>
  <pre><code>Dates  Ramp_1   Ramp_2  month
  0     2016-01-01 02:00:00  -823.0  -566.47      1
  1     2016-01-01 03:00:00  -899.0  -586.54      1
  2     2016-01-01 04:00:00  -652.0  -473.33      1
  3     2016-01-01 05:00:00  -304.0  -178.20      1
  4     2016-01-01 06:00:00    99.0   273.08      1
  ...                   ...     ...      ...    ...
  35045 2019-12-31 11:00:00  -613.0  -793.54     12
  35046 2019-12-31 12:00:00  -311.0 -1159.81     12
  35047 2019-12-31 13:00:00  -530.0  -964.18     12
  35048 2019-12-31 14:00:00    79.0   538.85     12
  35049 2019-12-31 15:00:00   181.0   574.21     12
  </code></pre>