title: KeyError: 'column name'
body: <p>The data in the excel file is already displayed as a table. The printed head is just like a normal one.</p>
  <pre><code>import pandas as pd
  data1=pd.read_excel('Données production auto A00 MCMA final.xlsx')
  data2=pd.read_excel('Données sinistres auto A00 MCMA final.xlsx')
  df=data2.merge(data1, on=&quot;clé&quot;)
  print(df)
  </code></pre>
  <p>the output is the following</p>
  <pre><code>
         Cout_ecreté              région   prime aquise   Age_CONDUCTEUR  \
  0          6850.00  Casablanca- Settat    8266.985598              NaN   
  1          6600.00  Casablanca- Settat   11951.189385              NaN   
  2          1000.00  Casablanca- Settat    1621.017561             57.0   
  3         14990.00  Casablanca- Settat    6184.749178              NaN   
  4          9561.94  Casablanca- Settat       1.000000              NaN   
  ...            ...                 ...            ...              ...   
  18353     39193.20   Darâa - Tafilalet       1.000000             36.0   
  18354     24865.00   Darâa - Tafilalet    4487.590493             29.0   
  18355      1100.00   Darâa - Tafilalet       1.000000             60.0   
  18356      6000.00   Darâa - Tafilalet    2169.730740             50.0   
  18357      6075.80   Darâa - Tafilalet    3118.503901             64.0   
  
         Age_vehicule  Ancienneté_permis   CRM        AR  
  0               0.2                NaN  0.96  4.774812  
  1               1.5                NaN  1.10  1.943874  
  2               5.0               39.0  0.90  0.670773  
  3               2.5                NaN  1.05  1.941136  
  4               1.0                NaN  0.90  0.996578  
  ...             ...                ...   ...       ...  
  18353           0.0                8.0  0.90  0.539357  
  18354           0.5                6.0  1.00  1.650924  
  18355           0.0               25.0  0.90  0.835044  
  18356           1.0                NaN  1.00  0.996578  
  18357           0.0                NaN  1.00  1.809719  
  
  [18358 rows x 8 columns]
  </code></pre>
  <p>and when I try the code :</p>
  <pre><code>Index(['Cout_ecreté', 'région', ' prime aquise', ' Age_CONDUCTEUR',
         'Age_vehicule', 'Ancienneté_permis', 'CRM', ' AR'],
        dtype='object')
  </code></pre>
  <p>However, when I try to run this code:</p>
  <pre><code>d1 = {'Cout_ecreté': pd.Series(df['Cout_ecreté']),
      'Age_CONDUCTEUR': pd.Series(df['Age_CONDUCTEUR'])}
  </code></pre>
  <p>I get this message error</p>
  <pre><code>---------------------------------------------------------------------------
  KeyError                                  Traceback (most recent call last)
  ~/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
     3360             try:
  -&gt; 3361                 return self._engine.get_loc(casted_key)
     3362             except KeyError as err:
  
  ~/opt/anaconda3/lib/python3.9/site-packages/pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
  
  ~/opt/anaconda3/lib/python3.9/site-packages/pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
  
  pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
  
  pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
  
  KeyError: 'Age_CONDUCTEUR'
  
  The above exception was the direct cause of the following exception:
  
  KeyError                                  Traceback (most recent call last)
  /var/folders/bk/5pw53lh96xj04n57g4t4mmkw0000gn/T/ipykernel_39377/3568698845.py in &lt;module&gt;
        1 d1 = {'Cout_ecreté': pd.Series(df['Cout_ecreté']),
  ----&gt; 2     'Age_CONDUCTEUR': pd.Series(df['Age_CONDUCTEUR'])}
  
  ~/opt/anaconda3/lib/python3.9/site-packages/pandas/core/frame.py in __getitem__(self, key)
     3456             if self.columns.nlevels &gt; 1:
     3457                 return self._getitem_multilevel(key)
  -&gt; 3458             indexer = self.columns.get_loc(key)
     3459             if is_integer(indexer):
     3460                 indexer = [indexer]
  
  ~/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
     3361                 return self._engine.get_loc(casted_key)
     3362             except KeyError as err:
  -&gt; 3363                 raise KeyError(key) from err
     3364 
     3365         if is_scalar(key) and isna(key) and not self.hasnans:
  
  KeyError: 'Age_CONDUCTEUR'
  
  </code></pre>
  <p>i don't know what seems to be the matter, the column name is spelled correctly.
  I tried this code to be more sure</p>
  <pre><code>df['Age_CONDUCTEUR']
  </code></pre>
  <p>but i also got the same error,
  can you help me please</p>