title: Replacing a dataframe's index value with dict's values?
body: <p>so i'm trying to define a function capable of reading relevant dataframes and replacing the index values for the values of a dictionary from a .csv file.
  I have something like this as my dataframe:</p>
  <pre><code>            ARR
  ID               
  1           3
  2           3
  3           3
  4           3
  5           3
  6           3
  7           4
  8           4
  9           4
  10          5
  </code></pre>
  <p>Next i have a .csv file with my ID's and their correspondent names(students).
  The function i created was something like this:</p>
  <pre><code>def naming(x):
      with open(path) as csv_file:
          csv_reader = list(csv.reader(csv_file, delimiter=','))
          y = {}
          for i in csv_reader:
              y.setdefault(i[0],i[1])
          for j in x.index:
              if j == y.keys():
                  x = x.replace([x.index], y.values())
  </code></pre>
  <p>I created a y dictionary with keys = ID's and values = names. However i seem to have a problem with the logic behind replacing the index values of an x dataframe and i can't seem to make it work.
  Whenever i summon my function naming(x) and apply it to my dataframe. The values aren't replaced.
  Any help? What am i doing wrong here?</p>