-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: column label filtering via regexes to work for numeric names #10384
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
Simple fix to allow regex filtering to work for numeric column labels, e.g. df.filter(regex="[12][34]")
can you add some tests? |
For search(x) -> search(str(x))? |
Any advice on what to add or where? I don't see any existing tests for this function... |
look in |
Thanks Jeff! Added the test. Let me know what you think... |
|
||
|
||
# regex with ints in column names | ||
df = DataFrame(0., index=[0, 1, 2], columns=[0, 1, 'A1', 'B']) |
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.
add the issue number as a comment (this PR number since no associated issue)
add a not in whatsnew/0.17.0. Put in Other Enhancements section What would this do in 0.16.2 (if you passed the regex), not fitler anything? or raise? |
Done! In 0.16.2 |
@@ -26,7 +26,8 @@ New features | |||
|
|||
Other enhancements | |||
^^^^^^^^^^^^^^^^^^ | |||
|
|||
- `regex` argument to DataFrame.filter now handles numeric column names instead of raising an exception. |
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.
use double backticks here (and around DateFrame.filter
)
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.
add the issue number (this PR number) onto the end (see how the other issues are done)
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.
say instead of raising ValueError
when you are all done, pls rebase/squash see contributing docs here |
Simple fix to allow regex filtering to work for numeric column labels, e.g. df.filter(regex="[12][34]") Add test for regex filter on numeric column names Add release note Add second regex test
I'm having trouble with squashing the commits. I don't have a ton of experience with git, so I'm not sure what to do next. Below is the message. Seems to have to do with a merge conflict in test_frame? Any advice?
|
contributing docs are here: http://pandas.pydata.org/pandas-docs/stable/contributing.html you have a conflict and need to fix it |
# The first commit's message is: Fix regex filter for numeric columns Simple fix to allow regex filtering to work for numeric column labels, e.g. df.filter(regex="[12][34]") Add test for regex filter on numeric column names Add release note Add second regex test # This is the 2nd commit message: Update generic.py Simple fix to allow regex filtering to work for numeric column labels, e.g. df.filter(regex="[12][34]")
Simple fix to allow regex filtering to work for numeric column labels, e.g. df.filter(regex="[12][34]")
Hmm, when I rebase it detects conflicts, then I resolve them using |
FYI, you don't normally need to add an issue if you just create a PR (like you did), but no biggie. |
I rebase you: https://travis-ci.org/jreback/pandas/builds/69631109 FYI don't use merge master. This is not pandas standard practice. This makes rebasing much more difficult. |
merged via bfe5a7f thanks! |
Simple fix to allow regex filtering to work for numeric column labels, e.g. df.filter(regex="[12][34]")
closes #10506