-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
BUG: Fix read_excel w/parse_cols & empty dataset #23661
BUG: Fix read_excel w/parse_cols & empty dataset #23661
Conversation
Hello @gfyoung! Thanks for submitting the PR.
|
Codecov Report
@@ Coverage Diff @@
## master #23661 +/- ##
=======================================
Coverage 92.24% 92.24%
=======================================
Files 161 161
Lines 51317 51317
=======================================
Hits 47338 47338
Misses 3979 3979
Continue to review full report at Codecov.
|
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.
LGTM: just one small question.
What are the changes to the excel file?
That's what I was hoping :) +1
…On Tue, Nov 13, 2018 at 8:00 AM gfyoung ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pandas/io/excel.py
<#23661 (comment)>:
> @@ -634,14 +634,17 @@ def _parse_cell(cell_contents, cell_typ):
else:
offset = 1 + max(header)
- for col in index_col:
- last = data[offset][col]
-
- for row in range(offset + 1, len(data)):
- if data[row][col] == '' or data[row][col] is None:
- data[row][col] = last
- else:
- last = data[row][col]
+ # Check if we have an empty dataset
+ # before trying to collect data.
+ if offset < len(data):
What are the changes to the excel file?
To add a test that addresses your question:
Do we have a test where offset is equal to len(data)?
Don't worry, I accounted for the off-by-one 😉
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#23661 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQHIkj7BfvgfE1ziQ8dXDqG8bhez2g0ks5uutBkgaJpZM4Ya6xX>
.
|
* upstream/master: (25 commits) DOC: Delete trailing blank lines in docstrings. (pandas-dev#23651) DOC: Change release and whatsnew (pandas-dev#21599) DOC: Fix format of the See Also descriptions (pandas-dev#23654) DOC: update pandas.core.groupby.DataFrameGroupBy.resample docstring. (pandas-dev#20374) ENH: Allow export of mixed columns to Stata strl (pandas-dev#23692) CLN: Remove unnecessary code (pandas-dev#23696) Pin flake8-rst version (pandas-dev#23699) Implement _most_ of the EA interface for DTA/TDA (pandas-dev#23643) CI: raise clone depth limit on CI BUG: Fix Series/DataFrame.rank(pct=True) with more than 2**24 rows (pandas-dev#23688) REF: Move Excel names parameter handling to CSV (pandas-dev#23690) DOC: Accessing files from a S3 bucket. (pandas-dev#23639) Fix errorbar visualization (pandas-dev#23674) DOC: Surface / doc mangle_dupe_cols in read_excel (pandas-dev#23678) DOC: Update is_sparse docstring (pandas-dev#19983) BUG: Fix read_excel w/parse_cols & empty dataset (pandas-dev#23661) Add to_flat_index method to MultiIndex (pandas-dev#22866) CLN: Move to_excel to generic.py (pandas-dev#23656) TST: IntervalTree.get_loc_interval should return platform int (pandas-dev#23660) CI: Allow to compile docs with ipython 7.11 pandas-dev#22990 (pandas-dev#23655) ...
…fixed * upstream/master: DOC: Delete trailing blank lines in docstrings. (pandas-dev#23651) DOC: Change release and whatsnew (pandas-dev#21599) DOC: Fix format of the See Also descriptions (pandas-dev#23654) DOC: update pandas.core.groupby.DataFrameGroupBy.resample docstring. (pandas-dev#20374) ENH: Allow export of mixed columns to Stata strl (pandas-dev#23692) CLN: Remove unnecessary code (pandas-dev#23696) Pin flake8-rst version (pandas-dev#23699) Implement _most_ of the EA interface for DTA/TDA (pandas-dev#23643) CI: raise clone depth limit on CI BUG: Fix Series/DataFrame.rank(pct=True) with more than 2**24 rows (pandas-dev#23688) REF: Move Excel names parameter handling to CSV (pandas-dev#23690) DOC: Accessing files from a S3 bucket. (pandas-dev#23639) Fix errorbar visualization (pandas-dev#23674) DOC: Surface / doc mangle_dupe_cols in read_excel (pandas-dev#23678) DOC: Update is_sparse docstring (pandas-dev#19983) BUG: Fix read_excel w/parse_cols & empty dataset (pandas-dev#23661) Add to_flat_index method to MultiIndex (pandas-dev#22866) CLN: Move to_excel to generic.py (pandas-dev#23656) TST: IntervalTree.get_loc_interval should return platform int (pandas-dev#23660)
Closes #9208.