title: Pandas.read_excel: Accessing the home directory
body: <p><strong>[Solution Found]</strong></p>
  
  <p>I have encountered some unexpected behavior when trying to access my home directory using <code>pandas.read_excel</code>.</p>
  
  <p>The file I want to access can be found at</p>
  
  <pre><code>/users/isys/orsheridanmeth
  </code></pre>
  
  <p>which is where <code>cd ~/</code> takes me to. The file I would like to access is</p>
  
  <pre><code>'~/workspace/data/example.xlsx'
  </code></pre>
  
  <p>The following works to read in the excel file (using <code>import pandas as pd</code>):</p>
  
  <pre><code>df = pd.read_excel('workspace/data/example_.xlsx', 'Sheet1')
  </code></pre>
  
  <p>whereas </p>
  
  <pre><code>df = pd.read_excel('~/workspace/data/example.xlsx', 'Sheet1')
  </code></pre>
  
  <p>gives me the following error:</p>
  
  <pre><code>df = pd.read_excel('~/workspace/data/example.xlsx', 'Sheet1')
  Traceback (most recent call last):
    File "/users/is/ahlpypi/egg_cache/i/ipython-3.2.0_1_ahl1-py2.7.egg/IPython/core/interactiveshell.py", line 3035, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
    File "&lt;ipython-input-397-4412a9e7c128&gt;", line 1, in &lt;module&gt;
      df = pd.read_excel('~/workspace/data/example.xlsx', 'Sheet1')
    File "/users/is/ahlpypi/egg_cache/p/pandas-0.16.2_ahl1-py2.7-linux-x86_64.egg/pandas/io/excel.py", line 151, in read_excel
      return ExcelFile(io, engine=engine).parse(sheetname=sheetname, **kwds)
    File "/users/is/ahlpypi/egg_cache/p/pandas-0.16.2_ahl1-py2.7-linux-x86_64.egg/pandas/io/excel.py", line 188, in __init__
      self.book = xlrd.open_workbook(io)
    File "/users/is/ahlpypi/egg_cache/x/xlrd-0.9.2-py2.7.egg/xlrd/__init__.py", line 394, in open_workbook
      f = open(filename, "rb")
  IOError: [Errno 2] No such file or directory: '~/workspace/data/example.xlsx'
  </code></pre>
  
  <p><strong>pandas.read_csv</strong> however worked when I used <code>pd.read_csv('~/workspace/data/example.csv')</code>.</p>
  
  <p>I would like to continue to use this relative paths to files. Any explanation why this doesn't work with <code>pandas.read_excel</code>?</p>
  
  <p><strong>Using <code>xlrd</code></strong></p>
  
  <p>when using <code>xlrd</code> I get a similar error: </p>
  
  <pre><code>import xlrd
  xl = xlrd.open_workbook('~/workspace/data/example.xlsx')
  Traceback (most recent call last):
    File "/users/is/ahlpypi/egg_cache/i/ipython-3.2.0_1_ahl1-py2.7.egg/IPython/core/interactiveshell.py", line 3035, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
    File "&lt;ipython-input-403-90af31feff4b&gt;", line 1, in &lt;module&gt;
      xl = xlrd.open_workbook('~/workspace/data/example.xlsx')
    File "/users/is/ahlpypi/egg_cache/x/xlrd-0.9.2-py2.7.egg/xlrd/__init__.py", line 394, in open_workbook
      f = open(filename, "rb")
  IOError: [Errno 2] No such file or directory: '~/workspace/data/example.xlsx'
  </code></pre>
  
  <p><strong>[SOLUTION]</strong></p>
  
  <pre><code>from os.path import expanduser as ospath
  df = pd.read_excel(ospath('~/workspace/data/example.xlsx'), 'Sheet1')
  </code></pre>