title: How can I solved KeyError: "None of [Index(['lymphoid_neoplasm'], dtype='object')] are in the [index]"
body: <p>This code line:</p>
  <pre><code>gen_histogram = df.loc[1, ['lymphoid_neoplasm']]
  </code></pre>
  <p>gives a error like <strong>KeyError: &quot;None of [Index(['lymphoid_neoplasm'], dtype='object')] are in the [index]&quot;</strong></p>
  <p>All code:</p>
  <pre><code>import numpy as np
  import pandas as pd
  
  df = pd.read_csv(&quot;CosmicMutantExportCensus.tsv&quot;, sep = '\t')
  
  primary_histology = df['Primary histology']
  gen_histogram = df.loc[1, ['lymphoid_neoplasm']]
  id_sample = df[&quot;ID_sample&quot;]
  # print(df[&quot;Primary histology&quot;])
  
  diseases = []
  for i in primary_histology:
     if i in diseases:
        continue
    else:
        diseases.append(i)
  # print(diseases, &quot;\n&quot;, len(diseases), &quot;farklı hastalık vardır.&quot;)
  
  ids = []
  for j in id_sample:
     if j in ids:
        j+=1
     else:
        ids.append(j)
   # print(ids, &quot;\n&quot;, len(ids), &quot; farklı Doku Id'si vardır.&quot;)
   # print(gen_histogram)
  </code></pre>