Skip to content

CLN: added io.api for i/o importing functions #3693

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

Merged
merged 2 commits into from
May 30, 2013

Conversation

jreback
Copy link
Contributor

@jreback jreback commented May 25, 2013

closes most of #3411 (all except the deprecation of from_csv)

  • moved excel functionaility out of io.parsers to io.excel
    added read_excel top-level function
    aliases from pandas.io.excel
  • added read_stata top-level function, to_stata DataFrame method
    aliases from pandas.io.stata
    removed read_dta (replace by read_stata)
  • added read_sql top-level function, to_sql DataFrame method
    aliases from pandas.io.sql

DOC: doc updates for all the above and intro section to io.rst

@jreback
Copy link
Contributor Author

jreback commented May 25, 2013

@wesm pls give this a once over

@jreback
Copy link
Contributor Author

jreback commented May 29, 2013

@y-p @wesm ok on this?

@ghost
Copy link

ghost commented May 30, 2013

IIRC, users rely on ExcelWriter directly to write mutliple tabs to the same file,
these changes would break (at least) that, no?

@jreback
Copy link
Contributor Author

jreback commented May 30, 2013

nope...its still there (and still exported by default)

@ghost
Copy link

ghost commented May 30, 2013

I must be missing something, how is this not a breaking change?

In [1]: from pandas.io.parsers import ExcelWriter

In [2]: from pandas.io.parsers import ExcelFile

In [3]: pd.__version__
Out[3]: '1.11.0.dev-6d08f1e'

(Note, I just pushed a change to master turning 0.12.0->0.11.1)

This PR:

In [1]: from pandas.io.parsers import ExcelFile
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-a9154a289dc3> in <module>()
----> 1 from pandas.io.parsers import ExcelFile

ImportError: cannot import name ExcelFile

In [2]: from pandas.io.parsers import ExcelWriter
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-39a586c0fd73> in <module>()
----> 1 from pandas.io.parsers import ExcelWriter

ImportError: cannot import name ExcelWriter

In [3]: pd.__version__
Out[3]: '0.12.0.dev-f7ad3c3'

@jreback
Copy link
Contributor Author

jreback commented May 30, 2013

yes, that is an API change, let me see if I can do a warning on that, or let it break?

in any event, the top-level namespace

import pandas as pd
pd.ExcelWriter

succeeds

@jreback
Copy link
Contributor Author

jreback commented May 30, 2013

I updated to give a warning if you try to use an ExcelWriter/ExcelObject imported from pandas.io.parsers

do you know if its possible to do this on import though?

e.g.

from pandas.io.parsers import ExcelWriter
ExcelWriter('foo.xls')

the warning won't print till the ExcelWriter line; any way to actually have it warn on that particular import?
some kind of import hook?

@ghost
Copy link

ghost commented May 30, 2013

Scratch that, Obviously everyone will get the object from the toplevel namespace.

@jreback
Copy link
Contributor Author

jreback commented May 30, 2013

actually, I think you have a valid point (as the docs did originally have you import from pandas.io.parsers)

@ghost
Copy link

ghost commented May 30, 2013

If you think so, then this doesn't belong in a minor release.
The semver contract is "if you upgrade a minor release, your code won't break", not "you'll get a warning".

Other then that, a welcome cleanup of an increasingly crowded space.

@jreback
Copy link
Contributor Author

jreback commented May 30, 2013

ahh...but I have made that so, you WILL get a warning (and your code wont' break)

ok....will proceed then...

@jreback
Copy link
Contributor Author

jreback commented May 30, 2013

@wesm any comments?

jreback added 2 commits May 30, 2013 10:33
     moved excel functionaility out of io.parsers to io.excel
     added read_excel top-level function
       aliases from pandas.io.excel
     added read_stata top-level function, to_stata DataFrame method
       aliases from pandas.io.stata
       removed read_dta (replace by read_stata)
     added read_sql   top-level function, to_sql DataFrame method
       aliases from pandas.io.sql

DOC: doc updates for all the above and intro section to io.rst
…cated path

DOC: minor edits in 0.11.1

DOC: cookbook/io.rst doc updates

TST: py3 issue on catching test warnings in test_parser_deprecated
jreback added a commit that referenced this pull request May 30, 2013
CLN: added io.api for i/o importing functions
@jreback jreback merged commit b8942c9 into pandas-dev:master May 30, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant