Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

gerigk opened this issue Dec 29, 2012 · 3 comments
Assignees
Labels
Enhancement IO Data IO issues that don't fit into a more specific label
Milestone

Comments

@gerigk
Copy link

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):
@changhiskhan
Copy link
Contributor

fixed. thanks!

@wesm
Copy link
Member

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 wesm reopened this Dec 29, 2012
@gerigk
Copy link
Author

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.

@ghost ghost assigned wesm Jan 20, 2013
@wesm wesm closed this as completed in 61f7320 Jan 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement IO Data IO issues that don't fit into a more specific label
Projects
None yet
Development

No branches or pull requests

3 participants