Skip to content

Plotting Int64 columns with nulled integers (NAType) fails #32073 #32387

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 28 commits into from
Closed

Plotting Int64 columns with nulled integers (NAType) fails #32073 #32387

wants to merge 28 commits into from

Conversation

jeandersonbc
Copy link
Contributor

@MarcoGorelli
Copy link
Member

Thanks @jeandersonbc

However, before this PR can be accepted, you need to write tests / make sure you don't break existing ones - see contributing to the code base:

pandas is serious about testing and strongly encourages contributors to embrace test-driven development (TDD). This development process “relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test.” So, before actually writing any code, you should write your tests. Often the test can be taken from the original GitHub issue. However, it is always worth considering additional use cases and writing corresponding tests.

Adding tests is one of the most common requests after code is pushed to pandas. Therefore, it is worth getting in the habit of writing tests ahead of time so this is never an issue.

@jeandersonbc
Copy link
Contributor Author

Thanks for the feedback @MarcoGorelli! I'm wondering whether the example provided in the related issue (first comment in #32073) would be sufficient to be added as a test in the TestDataFramePlots (test_frame.py) class. I started the discussion on tests on the issue yesterday (although here might be more appropriated).

Copy link
Contributor

@TomAugspurger TomAugspurger left a comment

Choose a reason for hiding this comment

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

Thanks for working on this. We'll need a test and a release note in 1.1.0.rst.

Comment on lines +419 to +421
if values.isna().any().all():
values = values.astype(float)

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like date-like data can be included here, and we don't want to convert those to floats.

I think this should be restricted to

if is_integer_dtype(values.dtype):
    values = values.to_numpy(dtype="float", na_value=np.nan)

jbrockmendel and others added 24 commits March 3, 2020 11:44
According to
https://docs.python.org/3/library/pickle.html#object.__reduce__,

> If a string is returned, the string should be interpreted as the name
> of a global variable. It should be the object’s local name relative to
> its module; the pickle module searches the module namespace to determine
> the object’s module. This behaviour is typically useful for singletons.

Closes #31847
@jeandersonbc
Copy link
Contributor Author

well, I'm going to close this pull request and work in a single branch as this was not the first time that I messed up after updating my branch

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.

Plotting Int64 columns with nulled integers (NAType) fails