Skip to content

Fix first_valid_index/last_valid_index on DataFrame of all None/NaN values #17646

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

Closed
wants to merge 1 commit into from

Conversation

cggarvey
Copy link

Ensures DataFrame behaves consistent to Series when calling first_valid_index or last_valid_index when all values in df are None/NaN.

  • closes df.first_valid_index() fails if there is no valid entry. #17400
  • added two test cases in pandas/tests/frame/test_timeseries.py (all other tests of first/last_valid_index() were located there) and verified that they failed prior to/passed after the change.
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff

…_valid_index/last_valid_index on all NaN values. Closes GH17400
@jreback
Copy link
Contributor

jreback commented Sep 23, 2017

#17488 already has this covered. thanks for the effort. lots of issues out there; welcome other PRs!

@jreback jreback closed this Sep 23, 2017
@codecov
Copy link

codecov bot commented Sep 23, 2017

Codecov Report

Merging #17646 into master will decrease coverage by 0.02%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17646      +/-   ##
==========================================
- Coverage   91.22%    91.2%   -0.03%     
==========================================
  Files         163      163              
  Lines       49655    49667      +12     
==========================================
+ Hits        45296    45297       +1     
- Misses       4359     4370      +11
Flag Coverage Δ
#multiple 88.99% <85.71%> (-0.01%) ⬇️
#single 40.16% <0%> (-0.08%) ⬇️
Impacted Files Coverage Δ
pandas/core/frame.py 97.68% <85.71%> (-0.19%) ⬇️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️

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 e2757a2...51844c2. Read the comment docs.

@codecov
Copy link

codecov bot commented Sep 23, 2017

Codecov Report

Merging #17646 into master will decrease coverage by 0.02%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17646      +/-   ##
==========================================
- Coverage   91.22%    91.2%   -0.03%     
==========================================
  Files         163      163              
  Lines       49655    49667      +12     
==========================================
+ Hits        45296    45297       +1     
- Misses       4359     4370      +11
Flag Coverage Δ
#multiple 88.99% <85.71%> (-0.01%) ⬇️
#single 40.16% <0%> (-0.08%) ⬇️
Impacted Files Coverage Δ
pandas/core/frame.py 97.68% <85.71%> (-0.19%) ⬇️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️

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 e2757a2...51844c2. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

df.first_valid_index() fails if there is no valid entry.
2 participants