Skip to content

BUG: Series.where not casting None to nan #39761

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

Merged
merged 3 commits into from
Feb 12, 2021

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

started off just moving more tests to use SetitemCastingEquivalents, found this in TestSeriesNoneCoercion

@jreback jreback added Indexing Related to indexing on series/frames, not to indexes themselves Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate labels Feb 12, 2021
@jreback jreback added this to the 1.3 milestone Feb 12, 2021
@jreback jreback merged commit 1779155 into pandas-dev:master Feb 12, 2021
@jbrockmendel jbrockmendel deleted the tst-setitem-11 branch February 12, 2021 01:35
@@ -837,53 +837,6 @@ def test_label_indexing_on_nan(self):
assert result2 == expected


class TestSeriesNoneCoercion:
EXPECTED_RESULTS = [
Copy link
Member

Choose a reason for hiding this comment

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

What the general rationale to decide which tests go in /tests/indexing and which in /tests/series/indexing ?

Here, it are tests that have a Series version and a DataFrame version (just below here). Since those tests are very similar, IMO it makes sense to keep them together?

Copy link
Member Author

Choose a reason for hiding this comment

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

What the general rationale to decide which tests go in /tests/indexing and which in /tests/series/indexing ?

Some of this is laid out in test_writing.rst. There is no doubt room for improvement in that file if you have suggestions.

The over-arching MO is to organize indexing tests by method. So anything for Series.__setitem__ would go in tests/series/indexing/test_setitem.py. Under this theory, all of tests(/frame|/series)?/indexing/test_indexing.py files and all of the tests(/frame|/series)?/indexing/test_{dtype}.py files would eventually have their tests moved to a method-specific file. Many of the remaining tests in these files are hard to categorize as being for a single method, so do not (yet?) conform to this pattern.

The MO specific to this PR and recent similar ones is to get more Series.__setitem__ tests to use SetitemCastingEquivalents which is proving very useful for finding inconsistencies. This cuts against the method-specific organization so the final location of it may be reconsidered at some point.

I expect we will either extend SetitemCastingEquivalents to include DataFrame cases or implement similar classes that handle cases SetitemCastingEquivalents can't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants