-
Notifications
You must be signed in to change notification settings - Fork 111
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
Extend Excel write/read to handle large data beyond the row limits #309
Conversation
Codecov Report
@@ Coverage Diff @@
## master #309 +/- ##
==========================================
+ Coverage 97.31% 97.41% +0.10%
==========================================
Files 39 41 +2
Lines 4090 4251 +161
==========================================
+ Hits 3980 4141 +161
Misses 110 110
Continue to review full report at Codecov.
|
2b1be35
to
bce03c4
Compare
ec0c31a
to
82c9ff5
Compare
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.
I left some comments
ixmp/backend/io.py
Outdated
if i > 1: | ||
suffix = '({})'.format(i) | ||
else: | ||
suffix = '' |
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.
Wouldn't it better to always add numeric prefix if number of elements is more than 1 sheet?
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.
Now, the sheets will be saved as foo, foo(1), foo(2), ... . I think it's better to see the sheets starting with the name of the items (in case the sheet name is not fully expanded).
In addition to the points raised by @zikolach, the documentation (current version shown here: https://message.iiasa.ac.at/projects/ixmp/en/master/file-io.html#scenario-model-data) needs to be adjusted to describe the new format. |
Thanks @khaeru, I extended the doc to reflect this. I also noticed a redundant sentence and deleted that. |
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.
Excellent @behnam-zakeri, thank you!
I used the Python built-in functions range()
, zip()
, and enumerate()
, plus the technique of defining a function-within-a-function, to streamline the code a little, but your improvements were already very tidy, and the addition of tests is a solid example.
Will merge once tests pass.
In response to issue #292, this PR extends the code in
ixmp.backend.io.py
to write and read large data, i.e., dataframes and series longer than the maximum row number of Excel.How to review
You can test this branch as it is. The tests are improved to reflect the new changes. ALternatively, you can export one of the global scenarios and check if parameter land_output is completely transferred to Excel in two sheets.
PR checklist