ExcelFile has non existent argument "kind" in the docstring #2613

Closed
gerigk opened this Issue Dec 29, 2012 · 3 comments

Comments

Projects
None yet
3 participants

gerigk commented Dec 29, 2012

class ExcelFile(object):
    """
    Class for parsing tabular excel sheets into DataFrame objects.
    Uses xlrd for parsing .xls files or openpyxl for .xlsx files.
    See ExcelFile.parse for more documentation

    Parameters
    ----------
    path : string or file-like object
        Path to xls file
    kind : {'xls', 'xlsx', None}, default None
    """
    def __init__(self, path_or_buf):
Contributor

changhiskhan commented Dec 29, 2012

fixed. thanks!

Owner

wesm commented Dec 29, 2012

We might want to be able to explicitly specify the file format? Right now you have to have the extension right

wesm reopened this Dec 29, 2012

gerigk commented Dec 30, 2012

I found out also, that if it is a buffer it tries to read it as an ".xls" and then silently falls back to ".xlsx" in case of an ImportError.
Since I had only openpyxl installed this resulted in a unicode error when opening a xls buffer.

data = path_or_buf.read()

            try:
                import xlrd
                self.book = xlrd.open_workbook(file_contents=data)
                self.use_xlsx = False
            except Exception:
                from openpyxl.reader.excel import load_workbook
                buf = py3compat.BytesIO(data)
                self.book = load_workbook(buf, use_iterators=True)

The 'kind' argument would help here.

wesm was assigned Jan 20, 2013

wesm closed this in 61f7320 Jan 20, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment