Skip to content
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

define fill value for where #576

Closed
mathause opened this issue Sep 15, 2015 · 4 comments
Closed

define fill value for where #576

mathause opened this issue Sep 15, 2015 · 4 comments

Comments

@mathause
Copy link
Collaborator

It would be nice if where accepts an other argument:

def where(self, cond, other=np.NaN):
    pass
@shoyer
Copy link
Member

shoyer commented Sep 15, 2015

Agreed. I didn't add this only because we don't yet have three-argument broadcasting operations working yet.

For now, a work around (at a slight cost in efficiency) is to use where followed by fillna.

@max-sixty
Copy link
Collaborator

This would be great to add - we just hit this (CC @justinkuosixty).

For now, a work around (at a slight cost in efficiency) is to use where followed by fillna.

This works, although if there are already NaNs, it requires another where to add those back

@jhamman
Copy link
Member

jhamman commented Jan 31, 2017

@shoyer - what do we need in order to get the 3-argument broadcasting working. I'd really like to get this into xarray.

@shoyer
Copy link
Member

shoyer commented Jan 31, 2017 via email

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

No branches or pull requests

4 participants