title: ValueError: No axis named Data for object type <class 'pandas.core.frame.DataFrame' - Pandas
body: <p>I executed the code bellow and is returned the error. Can anyone help me solve this error? Thanks a lot!! I need to read a .xlsx file and sum the column "Valor" grouped for the others columns and export to a .txt. file.</p>
  
  <p>data of the file .xlsx :</p>
  
  <p><a href="https://i.stack.imgur.com/YXcb8.png" rel="nofollow noreferrer">enter image description here</a> </p>
  
  <h2>Error:</h2>
  
  <pre><code>Traceback (most recent call last):
    File "import.py", line 37, in &lt;module&gt;
      main()
    File "import.py", line 31, in main
      data_grouped = data.groupby('registro', 'Data')['Valor'].sum()
    File "C:\Users\morei\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\core\generic.py", line 7883, in groupby
      axis = self._get_axis_number(axis)
    File "C:\Users\morei\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\core\generic.py", line 411, in _get_axis_number
      raise ValueError("No axis named {0} for object type {1}".format(axis, cls))
  ValueError: No axis named Data for object type &lt;class 'pandas.core.frame.DataFrame'&gt;
  </code></pre>
  
  <h2>Code:</h2>
  
  <pre><code>import os
  import csv
  import pandas as pd
  
  def data_read(excel_data, sheet):
      df = pd.read_excel (excel_data, sheet)
      df.columns = df.columns.str.strip()
      return df
  
  file_ = r'C:\Users\morei\Downloads\Morris\VENDAS KRUPP - Copia.xlsx' # raw string (r'string')
  
  def main():
      for index_sheet in range (0, 1):
          data = data_read(file_, index_sheet)
          print (data)
  
          #types = data.dtypes
          #print (types)
          #new_types = data.astype({'registro': 'object', 'Data': 'object', 'Data.1': 'object', 'rubrica': 'object', 'em Branco': 'object'}).dtypes
          #print (new_types)
  
          #data_grouped = data.groupby([0, 2])[8].sum() # the numbers are columns indexes of ther sheet
          data_grouped = data.groupby('registro', 'Data')['Valor'].sum()
  
          print(data_grouped)
      print('Executed!')
  
  if __name__ == "__main__":
      main()
  </code></pre>