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

ndarray.max() and .min() can now work on arrays of type 'S' and 'U' as s... #5596

Closed
wants to merge 1 commit into from

Conversation

Prastaruszek
Copy link

I am begginer to numpy and it's possible, this pull request needs some tune up to be completed. I will be very thankfull for all comments and advices.

I wrote some code on issue #1914 to enable calculating .min() and .max of arrays of types 'S' and 'U'.

I've added function _String_Min_Or_Max to methods.c and updated functions
array_min and array_max to handle string ndarrays. One can launch this
functions with arguments - keepdims, out and axis (which can be a tuple
to enable multidimensional reductions). The solution is based
on PyArray_ArgMin and PyArray_Argmax functs, as suggested in issue.

I've also created class TestMax in core/tests/test_multidimensional.py
in which several tests are placed.

…s suggested

in issue numpy#1914 .

I've added function _String_Min_Or_Max to methods.c and updated functions
array_min and array_max to handle string ndarrays. One can launch this
functions with arguments - keepdims, out and axis (which can be a tuple
to enable multidimensional reductions). The solution is based
on PyArray_ArgMin and PyArray_Argmax functs, as suggested in issue.

I've also created class TestMax in core/tests/test_multidimensional.py
in which several tests are placed.
@jaimefrio
Copy link
Member

HI @Prastaruszek, thanks for submitting this PR.

The error in the tests is due to the NPY_FORWARD_NDARRAY_METHOD macro defining variables, you can look at its definition here. It will probably all work fine if you wrap it in an else clause, although the fact that there is a static variable involved leaves me doubtful.

On a separate note, please take a look at the Numpy C Style Guide and adapt your code to it. The most obvious violation is not using 4 space indents through out.

@charris
Copy link
Member

charris commented Mar 22, 2015

Rejigger tests by closing and opening.

@charris charris closed this Mar 22, 2015
@charris charris reopened this Mar 22, 2015
@WarrenWeckesser
Copy link
Member

No response to @jaimefrio's comment in 2015, so this pull request appears to be abandoned. Closing, but discussion can continue if there is interest in resuming work on this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants