title: How can one switch the value and key of a Nested dictionary in Python?
body: <p>I am writing a deferred acceptance algorithm for doctors and hospitals, but before getting there I need my dictionaries to be presented in a correct manner.</p>
  
  <p>Currently, I have a dictionary of doctors containing a nested dictionary with their rankings of hospitals:</p>
  
  <pre><code>{'Doctor_7': {'Hospital_6': 4.0, 'Hospital_3': 8.0, 'Hospital_1': 10.0, 'Hospital_8': 1.0, 'Hospital_2': 9.0, 'Hospital_10': 5.5, 'Hospital_5': 5.5, 'Hospital_7': 2.0, 'Hospital_4': 7.0, 'Hospital_9': 3.0}
  </code></pre>
  
  <p>Here 'Hospital_6' indicates the hospital and 4.0 indicates its ranking by this specific doctor (4 out of 10 in this case)</p>
  
  <p>Due to the DataFrame from which I made this dictionary it is represented in its current form. However, I want the placement of 'Hospital_6' and 4.0 to switch. Hence, I want 4.0 to be a key and hospital_6 to be its value (of the nested dictionary).</p>
  
  <p>However, I do not quite know how to switch these two. If anyone could help me, that would be extremely appreciated!</p>