Skip to content

BUG: adds validation for boolean keywords in DataFrame.set_index #17853

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

Conversation

richardjgowers
Copy link

ENH: Adds util._validators.validate_keywords_as_bool decorator

I've used a decorator so that we can check all the boolean kwargs at once rather than have a lot of lines of validate_bool_kwarg at the top of every method.

@richardjgowers
Copy link
Author

Oh, and if people are happy with this decorator approach, I can go through and give all methods the same treatment/tests

@gfyoung gfyoung added the Error Reporting Incorrect or improved errors from pandas label Oct 12, 2017
@gfyoung
Copy link
Member

gfyoung commented Oct 12, 2017

Oh, and if people are happy with this decorator approach

Just for reference, can you list 1 - 2 places where this also could be applied? Seems reasonable otherwise, though I would check performance just in the case the decorator imposes too much overhead.

@richardjgowers
Copy link
Author

@gfyoung this could/(should according to @jreback #16714 (comment)) be applied to all boolean keyword arguments. So I could go through all of DataFrame, Series etc and decorate all methods with boolean kwargs

@gfyoung
Copy link
Member

gfyoung commented Oct 16, 2017

@richardjgowers : Sure, though if you could specify a couple just for reference which take multiple boolean arguments, that would be great.

@jreback
Copy link
Contributor

jreback commented Nov 12, 2017

can you rebase; move note to 0.22.0

@richardjgowers richardjgowers force-pushed the issue-16714-kwargboolvalidate branch from c50ef50 to 9d22f46 Compare November 13, 2017 21:24
@codecov
Copy link

codecov bot commented Nov 13, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@7495e9a). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #17853   +/-   ##
=========================================
  Coverage          ?   91.21%           
=========================================
  Files             ?      163           
  Lines             ?    50048           
  Branches          ?        0           
=========================================
  Hits              ?    45650           
  Misses            ?     4398           
  Partials          ?        0
Flag Coverage Δ
#multiple 89.02% <100%> (?)
#single 40.27% <100%> (?)
Impacted Files Coverage Δ
pandas/util/_validators.py 94.82% <100%> (ø)
pandas/core/frame.py 97.75% <100%> (ø)

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 7495e9a...9d22f46. Read the comment docs.

@codecov
Copy link

codecov bot commented Nov 13, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@7495e9a). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #17853   +/-   ##
=========================================
  Coverage          ?   91.21%           
=========================================
  Files             ?      163           
  Lines             ?    50048           
  Branches          ?        0           
=========================================
  Hits              ?    45650           
  Misses            ?     4398           
  Partials          ?        0
Flag Coverage Δ
#multiple 89.02% <100%> (?)
#single 40.27% <100%> (?)
Impacted Files Coverage Δ
pandas/core/frame.py 97.75% <100%> (ø)
pandas/util/_validators.py 94.82% <100%> (ø)

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 7495e9a...8c530dd. Read the comment docs.

@richardjgowers richardjgowers force-pushed the issue-16714-kwargboolvalidate branch from 9d22f46 to 6dd8308 Compare November 13, 2017 21:31
ENH: Adds util._validators.validate_keywords_as_bool decorator
@richardjgowers richardjgowers force-pushed the issue-16714-kwargboolvalidate branch from 6dd8308 to 8c530dd Compare November 13, 2017 22:50
@jreback
Copy link
Contributor

jreback commented Dec 28, 2017

closing as stale, if you want to work on this, pls ping.

@jreback jreback closed this Dec 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

inplace kwarg must be of bool type, but other boolean kwargs don't have this restriction
3 participants