Skip to content
Discussion options

You must be logged in to vote

This should work with reduce? Also pd.unique is usually faster than np.unique and won't return multiple NaNs

For apply_ufunc:

  1. input_core_dims should be the dimension you're reducing
  2. I think you have no output_core_dims
  3. To loop over an axis like apply_along_axis use vectorize=True.
    You might even try
def the_unique(x):
	x = x[~np.isnan(x)]
	uniq = x[0]
	assert (x == uniq).all()
	return x

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zmoon
Comment options

Answer selected by zmoon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants