title: Pandas Groupby is returning an empty dataframe
body: <p>I have been trying to combine a set of data (77x1005 rows) using a Pandas dataframe with the groupby option. I need to sum the grouped values of each column. Whilst I am able to get a result if I put some columns manually, I get an empty dataframe if I select almost all columns.</p>
  <p>This is the code I am using</p>
  <pre><code>    MD_transpose_freq=Machine_Data_filter_freq.transpose()
      MD_freq_temp=MD_transpose_freq
      MD_freq_temp.iloc[2:,:]=MD_transpose_freq.iloc[2:,:].sort_values([0,1])
      MD_freq_temp.columns=MD_freq_temp.iloc[0] # we copy the first row as the column name
      MD_freq=MD_freq_temp[2:] #We delete the first two rows so make the grouping easier
      MD_freq=MD_freq.reset_index(drop=True)
  
      List_freq=list(MD_freq[5:].columns)
      List_freq=List_freq[5:] #we remove the columns we do not need.
      
      MD_freq_day=MD_freq.groupby(['Date','Week','Month','Year']).sum()
  </code></pre>
  <p>And this is the return I got</p>
  <pre><code>MD_freq_day
  Out[614]: 
  Empty DataFrame
  Columns: []
  Index: [(2022-05-01, 17, 5, 2022), (2022-05-02, 18, 5, 2022), (2022-05-03, 18, 5, 2022), (2022-05-04, 18, 5, 2022), (2022-05-05, 18, 5, 2022), (2022-05-06, 18, 5, 2022), (2022-06-01, 22, 6, 2022), (2022-06-02, 22, 6, 2022), (2022-06-03, 22, 6, 2022), (2022-06-04, 22, 6, 2022), (2022-06-05, 22, 6, 2022), (2022-07-01, 26, 7, 2022), (2022-07-02, 26, 7, 2022), (2022-07-03, 26, 7, 2022), (2022-07-04, 27, 7, 2022), (2022-07-05, 27, 7, 2022), (2022-08-01, 31, 8, 2022), (2022-08-02, 31, 8, 2022), (2022-08-03, 31, 8, 2022), (2022-08-04, 31, 8, 2022), (2022-08-05, 31, 8, 2022), (2022-09-01, 35, 9, 2022), (2022-09-02, 35, 9, 2022), (2022-09-03, 35, 9, 2022), (2022-09-04, 35, 9, 2022), (2022-09-05, 36, 9, 2022)]
  </code></pre>
  <p>I have also tried the following variation</p>
  <pre><code>MD_freq_day=MD_freq.groupby(['Date','Week','Month','Year'], as_index=False)[List_freq].sum()
  </code></pre>
  <p>And I get the following error</p>
  <pre><code>Traceback (most recent call last):
  
    File &quot;C:\Users\jvms\AppData\Local\Temp\ipykernel_20172\4128687025.py&quot;, line 1, in &lt;cell line: 1&gt;
      MD_freq_day=MD_freq.groupby(['Date','Week','Month','Year'], as_index=False)[List_freq].sum()
  
    File &quot;C:\Users\jvms\OneDrive - Cap\Personal\Portable Apps\Python-Portable-3.9.6\apps\lib\site-packages\pandas\core\groupby\generic.py&quot;, line 1538, in __getitem__
      return super().__getitem__(key)
  
    File &quot;C:\Users\jvms\OneDrive - Cap\Personal\Portable Apps\Python-Portable-3.9.6\apps\lib\site-packages\pandas\core\base.py&quot;, line 222, in __getitem__
      raise KeyError(f&quot;Columns not found: {str(bad_keys)[1:-1]}&quot;)
  
  KeyError: 'Columns not found: '
  </code></pre>
  <p>This is how my data looks like <a href="https://i.stack.imgur.com/39tFC.png" rel="nofollow noreferrer">Data screenshot</a></p>
  <p>My data does not have any empty values or na values.</p>