-
Notifications
You must be signed in to change notification settings - Fork 173
[ENH] Add null_flag function #501 #510
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
Codecov Report
@@ Coverage Diff @@
## dev #510 +/- ##
==========================================
+ Coverage 92.88% 92.92% +0.03%
==========================================
Files 10 10
Lines 872 891 +19
==========================================
+ Hits 810 828 +18
- Misses 62 63 +1 |
Just realized I probably need to add some files to the docs folder. Will do that tomorrow. |
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.
Thanks for the PR, @anzelpwj! I think this will be a great addition to the library. From this first-pass review, I have a few requested changes, mostly centering around docstrings + the tests, with the comments coming from a maintainability perspective. Hope you understand 😄.
Everything looks great, thanks @anzelpwj! |
@ericmjl, @anzelpwj I can move this conversation to an issue if more appropriate. I rebased recently and included this PR. I'm getting some failing tests that were added with this PR:
The issue is that Adding a line like: expected = expected.astype({"null_flag": "int32"}) fixes the issues. Any thoughts? I'm on Windows in a pyjanitor venv w/ Python 3.7.4, Pandas 0.24.2 |
Hmmm, what if we explicitly set |
Hmm, I believe that is the default, and setting it explicitly didn't change for me. So that's even stranger that this is happening. |
It is default, but thought we'd check anyway. I'd be fine with this fix, but TBH we should open up a ticket on the Pandas project to list this as a bug with their assert method. |
I am on Windows10 and getting the exact same 4 tests failing, reported by @hectormz above.
The thing is, I am just getting the dev env set up. I haven't made a single change to the code or to the docs yet. Is there any way to 'soften' these tests so that int32 and int64 are treated as equivalent dtypes? |
@hectormz I am using Anaconda's Python.
|
Would y'all like me to make the extra PR for the |
@anzelpwj Yes, please. That will help me. I can rebase and continue. |
PR Description
Adds a null flag function, which creates a new column in a DataFrame to mark which rows had null values. You can choose a subset of columns to consider as needed.
This PR resolves #501.
PR Checklist
Please ensure that you have done the following:
<your_username>
:master, but rather from<your_username>
:<branch_name>.AUTHORS.rst
.CHANGELOG.rst
under the latest version header (i.e. the one that is "on deck") describing the contribution.Quick Check
To do a very quick check that everything is correct, follow these steps below:
make check
from pyjanitor's top-level directory. This will automatically run:Once done, please check off the check-box above.
If
make check
does not work for you, you can execute the commands listed in the Makefile individually.Code Changes
If you are adding code changes, please ensure the following:
$ pytest .
) locally on your machine.Relevant Reviewers
Please tag maintainers to review.