title: Python Dataframe index as a tuple of XY Coordinates
body: <p>My function <code>collectHUC</code> takes XY coordinates and builds a dictionary of HUC codes named <code>stationsXY</code>  for 1000 stations. The <code>keys</code> are tuples like <code>('41.462605 ', '-74.387089')</code> with <code>values</code> like <code>0202000600</code>. This process takes time, so I convert <code>stationsXY</code> to a DataFrame and save it as follows for later use:</p>
  
  <pre><code>xy = pd.DataFrame.from_dict(stationsXY, orient='index')
  xy.to_csv('xy_huc.csv', index=False)
  </code></pre>
  
  <p>Here is the issue, when reading back the file <code>xy_huc.csv</code> with</p>
  
  <pre><code>xy_coor = pd.read_csv('xy_huc.csv', index_col=0, header=None)
  </code></pre>
  
  <p>The DataFrame <code>xy_coor</code> has 2 columns, column 0 for the XY coordinates and column 1 for HUC codes, by setting column 0 as the index, the index format is <code>string</code> now and not <code>tuple</code>. I have tried these so far:</p>
  
  <ol>
  <li><p>Read the csv file, setting the index as a multi-index from the column</p>
  
  <pre><code>xy_coor = pd.read_csv('xy_huc.csv', index_col=0, header=None)
  xy = pd.DataFrame(xy_coor, index=pd.MultiIndex.from_tuples(xy_coor.index))
  </code></pre>
  
  <p>but I have got this error</p>
  
  <pre><code>TypeError: Expected tuple, got str
  </code></pre></li>
  <li><p>Read the csv with <code>index_col=False</code>, set the index to column zero</p>
  
  <pre><code>xy_coor = pd.read_csv('xy_huc.csv', index_col=False, header=None)
  xy = pd.DataFrame(stations_xy, index=pd.MultiIndex.from_tuples(xy_coor[0]))
  </code></pre>
  
  <p>but <code>xy</code> indexes are in this form</p></li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/SDUIh.jpg" rel="nofollow noreferrer">xy DataFrame for point 2</a></p>
  
  <p>I am willing to retrieve the file in the same format it was saved on. Any suggestions/recommendations are appreciated.</p>
  
  <p>Thanks</p>