Skip to content

Add nrows parameter to pandas.read_excel() #18507

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 7 commits into from
Dec 9, 2017
Merged

Add nrows parameter to pandas.read_excel() #18507

merged 7 commits into from
Dec 9, 2017

Conversation

alysivji
Copy link
Contributor

I was working on this a few months back, but got busy. Apologies. I'm free until January so thought I'd pick this back up.

Changes

  • Added code for nrows parameter (with tests)
  • Changed order of parameters to match pandas.read_csv() signature (across entire pandas/io/excel.py file)
  • Increased readability by having one parameter per line
  • Updated docstring to match new order (+ new entry for nrows param)

I think that covered all the outstanding issues from the previous (closed) PR. Please let me know if you need anything changed or modified.

@jreback jreback added Compat pandas objects compatability with Numpy or Python functions IO Excel read_excel, to_excel labels Nov 26, 2017
@foresmac
Copy link

LGTM; Travis build issues appear to be related to quote issues and not test failures.

Copy link

@foresmac foresmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alysivji
Copy link
Contributor Author

alysivji commented Dec 3, 2017

Hi @jreback @gfyoung
Could you please take a look at this when you have some time?

Thanks!

@gfyoung
Copy link
Member

gfyoung commented Dec 3, 2017

@alysivji : Thanks for the ping. A couple of points:

  1. We do need the Travis builds to pass before we can merge this. I'll double-check to see if you need to do anything to fix that.

  2. Your PR is for adding nrows to read_excel, but you also changed up the signature. IMO that's a little too much API changing in one PR for us to review. Let's break up this PR into two by separating out your read_excel signature changes into a separate PR.

I'm totally onboard for adding nrows but need to review your signature changes separately.

@codecov
Copy link

codecov bot commented Dec 3, 2017

Codecov Report

Merging #18507 into master will decrease coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18507      +/-   ##
==========================================
- Coverage    91.6%   91.56%   -0.05%     
==========================================
  Files         153      153              
  Lines       51272    51273       +1     
==========================================
- Hits        46969    46947      -22     
- Misses       4303     4326      +23
Flag Coverage Δ
#multiple 89.42% <100%> (-0.03%) ⬇️
#single 40.68% <62.5%> (-0.11%) ⬇️
Impacted Files Coverage Δ
pandas/io/excel.py 90.13% <100%> (ø) ⬆️
pandas/io/parsers.py 95.55% <100%> (ø) ⬆️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/plotting/_converter.py 64.78% <0%> (-1.74%) ⬇️
pandas/util/testing.py 81.82% <0%> (-0.2%) ⬇️
pandas/core/frame.py 97.81% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 27a64b2...c52315f. Read the comment docs.

input argument, the Excel cell content, and return the transformed
content.
parse_cols : int or list, default None
.. deprecated:: 0.21.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need a blank line before the deprecated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been fixed, also added a blank line in the sheetname section. Thanks.

@jreback
Copy link
Contributor

jreback commented Dec 3, 2017

I am ok with the re-aranging of parameters in this PR. pls rebase.

@alysivji
Copy link
Contributor Author

alysivji commented Dec 9, 2017

@jreback How does this look? Any changes needed?

@jreback jreback added this to the 0.22.0 milestone Dec 9, 2017
@jreback jreback merged commit 1a46dba into pandas-dev:master Dec 9, 2017
@jreback
Copy link
Contributor

jreback commented Dec 9, 2017

thanks!

@Sabr3tooth
Copy link

Hi folks,

Reading the Whats New for Pandas 0.22.0 as well as checking the pandas.read_excel page I note that nrows param is not yet available for read_excel(..). Is there any indication as to when as well as what version of Pandas it will be added? Thanks in advance to the people involved in adding this functionality, keep up the great work!

@alysivji
Copy link
Contributor Author

@Sabr3tooth Pandas 0.22 had a single API breaking change.

This enhancement will be in 0.23 based on the whatsnew in master

@Sabr3tooth
Copy link

Thanks, looking forward to seeing it in Pandas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions IO Excel read_excel, to_excel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pandas read_excel: only read first few lines
5 participants