Skip to content
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

Remove NotImplementedError for parse_dates keyword in read_excel #15820

Closed
wants to merge 3 commits into from

Conversation

jreback
Copy link
Contributor

@jreback jreback commented Mar 27, 2017

rebase of #12051 and fixes on top

closes #11544

@jreback jreback added Bug Enhancement IO Excel read_excel, to_excel labels Mar 27, 2017
@jreback jreback added this to the 0.20.0 milestone Mar 27, 2017
@@ -1176,13 +1176,18 @@ def _should_parse_dates(self, i):
if isinstance(self.parse_dates, bool):
return self.parse_dates
else:
name = self.index_names[i]
if self.index_names is not None:
name = self.index_names[i]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jorisvandenbossche this fixes, though not quite sure why this could/would be None here.

@gfyoung any idea?

Copy link
Member

Choose a reason for hiding this comment

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

index_names is None by default, though why that wasn't caught before is strange.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right. yep must not have taken that path at all, e.g. read_csv(..., parse_dates=['column_name'], index_col=0) is all that this is doing.......

if you want to look and see maybe missing something obvious, would be great.

Copy link
Member

Choose a reason for hiding this comment

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

Sure thing. Just curious, what test was failing beforehand that allowed you to catch this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jorisvandenbossche re-enabled the parse_dates kw in read_excel, but was failing on this. Note that this by-definition is only python engine. (as that is what excel uses).

@jreback
Copy link
Contributor Author

jreback commented Mar 27, 2017

I'll fix the authorship on merge.

@jorisvandenbossche
Copy link
Member

Thanks for resurrecting this! Not directly an idea about your question (that was the reason I didn't update the PR, as I didn't found the time to dive into the parsers code to figure this out)

"is not implemented")
if parse_dates is True and index_col is None:
warn("The 'parse_dates=True' keyword of read_excel was provided"
" without an 'index_col' keyword value.")

Copy link
Member

Choose a reason for hiding this comment

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

Can we add a test that hits this warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added, though I am puzzled why a simple parse_dates=True doesn't just work.....

grahamjeffries and others added 3 commits March 27, 2017 15:41
Rebase and update of PR #12051

Author: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Author: Graham R. Jeffries <graham.r.jeffries@gmail.com>

This patch had conflicts when merged, resolved by
Committer: Jeff Reback <jeff@reback.net>

Closes #14326 from jorisvandenbossche/pr/12051 and squashes the following commits:

0b65a7a [Joris Van den Bossche] update wording
656ec44 [Joris Van den Bossche] Fix detection to raise warning
b1c7f87 [Joris Van den Bossche] add whatsnew
925ce1b [Joris Van den Bossche] Update tests
0e10a9d [Graham R. Jeffries] remove read_excel kwd NotImplemented error, update documentation #11544
@codecov
Copy link

codecov bot commented Mar 27, 2017

Codecov Report

Merging #15820 into master will increase coverage by <.01%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15820      +/-   ##
==========================================
+ Coverage   90.99%   90.99%   +<.01%     
==========================================
  Files         143      143              
  Lines       49401    49403       +2     
==========================================
+ Hits        44954    44956       +2     
  Misses       4447     4447
Impacted Files Coverage Δ
pandas/io/excel.py 79.67% <100%> (ø) ⬆️
pandas/io/parsers.py 95.52% <80%> (ø) ⬆️

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 71f621f...a1eee67. Read the comment docs.

@jreback
Copy link
Contributor Author

jreback commented Mar 27, 2017

@jorisvandenbossche good with this (it all passed ). ?

@jorisvandenbossche
Copy link
Member

Yes, if it passes the tests, good for me! (but as I said, can't really assess if the changes in the parser code are sensible)

@jreback jreback closed this in 1dab800 Mar 28, 2017
@jreback jreback deleted the pr/12051 branch March 28, 2017 12:51
mattip pushed a commit to mattip/pandas that referenced this pull request Apr 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Enhancement IO Excel read_excel, to_excel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ERR: raise NotImplemented error if keywords are passed to read_excel which are not supported
4 participants