-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
allow path to be an StringIO object and skip extension check for that case #5992
Conversation
… case to allow in-memory creation of excel-files from pandas
what is the use case for this? |
i have a large django database and i do my exports for reporting in csv and excel formats via django-pandas (and thus via pandas) xlsxwriter provides this functionality and only the file-extension check inside pandas prevented me from using the in-memory-only version of xlsxwriter |
ahh...makes sense, ok need some tests for this then (simple as create a frame, save it to a buffer, prob save the buffer, then read it back and compare); I don't think that you can READ from a buffer as not sure that makes any sense (you would have to have xlrd stream it to you, not even sure if that is possible). |
here is the code i use currently:
i don't know why the explicit call to save() is necessary but without it the xslx comes back empty. I'll try to provide what you asked for, too |
what I mean is pls add the tests to the PR their are a lot of existing tests in |
ok, I'll try my best although i have never written tests in python |
@fennnec just copy paste the test format and modify to use your change. The ideal way is to write the test first, have it fail, then apply your change and have it fix the issue (and not break anything else!) |
i tested it in my application by hand |
@fennnec we can only accept patches that have associated tests your patch won't work even with local testing as their is a syntax error |
well, it works locally here
so i don't know what the problem with another setup is |
@@ -18,6 +18,7 @@ | |||
import pandas.compat as compat | |||
import pandas.core.common as com | |||
from warnings import warn | |||
from StringIO import StringIO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to do: from pandas.compat import StringIO in order to pass python3
could you perhaps point me in the right direction for the python 3 errors, since i don't really understand what's going wrong there on the save method |
IIRC you have to use io.BytesIO (and not StringIO) as its opened in binary mode. @jtratner ? |
…urns-str TST: fix test that repr returns str
BUG: Bug in setting using fancy indexing a single element with a non-scalar (e.g. a list) (GH6043)
BUG: less false positives with SettingWithCopy (GH6025)
passes travis now |
gr8, pls add a release note (reference this PR) in 0.13.1, API changes (edit doc/source/release.rst) then squash to a single commit see here: https://github.com/pydata/pandas/wiki/Using-Git |
This was done in a half-assed manner and has all the appearence of a thrown-over-the-wall patch. 👎 |
skip extension check for that case to allow in-memory creation of excel-files from pandas dataframes. add a testcase and reference the PR in release notes
@jreback, don't let me put you in a difficult position. If you're satisfied that this |
|
There's also a ton of merge commits. |
needs to be rebased on current master |
@fennnec needs a rebase |
closing this. @fennnec if you want to resubmit this we can take a look again |
this is to allow in-memory creation of excel-files from pandas