Skip to content

DOC: Document ma.filled behavior with non-scalar fill_value #13698

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 7 commits into from
Nov 24, 2019

Conversation

kritisingh1
Copy link
Member

Closes #4363
xref #13241 #10504

@mattip for now, I have just documented the behavior with non-scalar fill values. The PRs xref'ed above talked about deprecating the non-scalar nature(optional) of fill value. Do we really need to deprecate if we are already mentioning that, that behavior is not supported and throwing a meaningful error?
Also, should I include examples of what fill_values with input array combination could be risky?

@mattip
Copy link
Member

mattip commented Jun 2, 2019

I think examples would be nice. We should also standardize the Defalt is ... stanza, altough the nupydoc guide doesn't give clear guidance to what is the One Best Way. Maybe it appears somewhere else?

Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

I'm not sure we want to document this, as remarked in the other issues you xref

@eric-wieser eric-wieser dismissed their stale review June 7, 2019 07:15

Misread this patch

@mattip
Copy link
Member

mattip commented Jun 7, 2019

We should implement the deprecation warning as in #13421, and add the examples from there.

@kritisingh1
Copy link
Member Author

The test I have commented out is the one which fails due to Attribute error: type object tuple has no attribute shape. I am not sure what should be done for this case. In my opinion, it would be too naive to add a condition in the if statement for passing one test. Instead we can modify the test in a way that it does not contain the commented out line and instead write deprecation tests for checking the behavior when fill_value is non-scalar non-broadcastable. Let me know what would be better.

@kritisingh1
Copy link
Member Author

kritisingh1 commented Jun 17, 2019

@seberg when I added a check like

if((np.isscalar(fill_value) == True) or (ndtype.shape == fill_value.shape)):
return np.array(fill_value)
else:
err_msg = "Cannot find valid fill_value for dtype %s"
raise TypeError(err_msg % ndtype)

at the end of the _check_fill_value, around 18 tests are failing, logs of which are present here Am I missing something?

@mattip mattip assigned mattip and unassigned mattip Jul 2, 2019
@mattip mattip self-requested a review July 2, 2019 17:06
"arrays with scalar values instead. The filled function "
"still supports any array as `fill_value`.",
DeprecationWarning, stacklevel=2)

Copy link
Member

Choose a reason for hiding this comment

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

Needs a date and version comment so we know when we can turn the deprecation into an error

@mattip mattip added the 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes label Aug 19, 2019
@mattip
Copy link
Member

mattip commented Aug 19, 2019

Release note needed for the new deprecation

@rgommers
Copy link
Member

This looks almost ready, just need to add a 1.18.0 version number to the deprecation, and a release note.

@rgommers rgommers added this to the 1.18.0 release milestone Oct 18, 2019
@mattip mattip merged commit 0b8a241 into numpy:master Nov 24, 2019
@mattip
Copy link
Member

mattip commented Nov 24, 2019

Thanks @kritisingh1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
04 - Documentation 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes component: numpy.ma masked arrays
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: Document ma.filled behavior with non-scalar fill_value
6 participants