summaryrefslogtreecommitdiff
path: root/numpy/ma/core.py
Commit message (Collapse)AuthorAgeFilesLines
* BUG: Fix masked array ravel order for A (and somewhat K)Sebastian Berg2023-04-281-1/+1
| | | | | | Swaps the order to the correct thing and thus closes gh-23651
* BUG: Ignore invalid and overflow warnings in masked setitemSebastian Berg2023-04-211-0/+12
| | | | | | | | | | | | Giving a warning for invalid/overflow in settitem/casts is right (IMO), however for masked arrays it can be surprising since the warning is not useful if the value is invalid but also masked. So, simply blanket ignore the relevant warnings in setitem via errstate. (There may be some other cases like `.astype()` where it might be helpful to MA users to just blanket opt-out of these new warnings.) Closes gh-23000
* DOC: Add Examples section to np.ma.sort docstring (#23392)Somasree Majumder2023-04-131-0/+15
| | | Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* DOC: Add docstring examples for np.ma.right_shift (#23393)Somasree Majumder2023-04-101-0/+15
| | | | Co-authored-by: Charles Harris <charlesr.harris@gmail.com> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* DOC: Add example for np.ma.compressed. (#23426)Stefanie Molin2023-04-041-0/+23
| | | | | | | * DOC: Add example to np.ma.compressed(). * Update example. * Update core.py
* MAINT: move `mask_rowcols` to `ma/extras.py`yuki2023-03-251-91/+0
|
* ENH: revert changes of `mask_rowcols`yuki2023-03-221-8/+12
|
* Merge branch 'main' into enh-ma-dotyuki2023-03-221-1/+1
|\
| * BUG: ma with structured dtypeTyler Reddy2023-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #22041 * add regression test and fix for creating a masked array with a structured dtype; the test is simply for lack of error in the repoducer * the concern expressed by core team in matching issue was that `astropy` might be negatively affected; I ran full `astropy` (hash: `c9ad7c56`) test suite locally with this feature branch and it seemed "ok," just 1 unrelated network failure in the network-requiring tests (`test_ftp_tls_auto`): ```1 failed, 21430 passed, 3490 skipped, 176 xfailed, 23275 warnings in 430.18s (0:07:10)```
* | add support for non-2d arraysyuki2023-03-031-25/+36
|/
* BUG: PR 23269 revisionsTyler Reddy2023-02-251-1/+1
| | | | | * handle 0-D masked object array deepcopies, with regression test, based on reviewer feedback
* MAINT: PR 23269 revisionsTyler Reddy2023-02-241-1/+1
| | | | | * the deepcopy of masked array object type now also includes the components beyond just `_data`; add a related test case
* MAINT: PR 23269 revisionsTyler Reddy2023-02-241-3/+2
| | | | | | | | | | | | | | * guard masked array `__deepcopy__` special object handling behind `dtype.hasobject`, based on reviewer feedback * masked array `__deepcopy__` for object type handling now deepcopies from `self._data` directly, based on reviewer feedback * add a test case for 2D masked array object deepcopies, since reviewer was not convinced this was working
* BUG: masked array proper deepcopiesTyler Reddy2023-02-231-1/+14
| | | | | | | | | | | | | | | | | Fixes #22556 Fixes #21022 * add regression test and fix for gh-22556, where we were relying on the array `copy` arg to deepcopy a compound object type; I thought about performance issues here, but if you are already in the land of `object` and you are explicitly opting in to `deepcopy`, it seems like performance might be wishful thinking anyway * add regression test and fix for gh-21022--this one was weirder but seems possible to sidestep by not trying to assign a shape of `()` to something that already has shape `()` and a non-writeable `shape` attribute
* BUG: fix ma.diff not preserving mask when using append/prepend (#22776)Marko Pacak2023-01-191-6/+135
| | | | | Port CORE diff relevant code to MA and adapt docstrings examples and add tsts. Closes gh-22465
* DOC: Add example for np.ma.diag (#22960)Stefanie Molin2023-01-161-0/+32
| | | | | | | * DOC: Add example for np.ma.diag as part of numpy#22269 * Add descriptions to example. * Fix typo.
* API: Ensure a full mask is returned for masked_invalidSebastian Berg2022-12-211-1/+6
| | | | | | | | Matplotlib relies on this, so we don't seem to have much of a choice. I am surprised that we were not notified of the issue before release time. Closes gh-22720, gh-22720
* BUG: Do not use getdata() in np.ma.masked_invalidSebastian Berg2022-12-191-5/+5
| | | | | | | | | | | | This is the minimal solution to fix gh-22826 with as little change as possible. We should fix `getdata()` but I don't want to do that in a bug-fix release really. IMO the alternative is to revert gh-22046 which would also revert the behavior noticed in gh-22720 (which seems less harmful though). Closes gh-22826
* ENH: Speedup masked array creation when mask=None (#22725)Lefteris Loukas2022-12-051-1/+7
| | | | | | | This PR Closes gh-17046. The problem was that when calling mask=None, the array creation took seconds compared to the microseconds needed when calling mask=False. Using `mask=None` is a bit dubious, since it has a different meaning from the default `mask=nomask`, but the speed trap is so hard to find, that it seems pragmatic to support it. OTOH, it also would seem fine to deprecate the whole path (or maybe see if the path can be sped up so that the speed difference isn't forbidding eough to bother).
* Merge pull request #22436 from cmarmo/doc-masked-equalSebastian Berg2022-11-211-17/+11
|\ | | | | DOC: Clarify docstring of `masked_equal` and `masked_values`
| * Update numpy/ma/core.pySebastian Berg2022-11-211-3/+1
| |
| * Address reviewer comment.Chiara Marmo2022-10-171-2/+4
| |
| * Clarify docstring of masked_valuesChiara Marmo2022-10-131-14/+8
| |
* | DOC: Add example for np.ma.power as part of #22269Stefanie Molin2022-11-191-0/+26
| |
* | MAINT: remove u-prefix for former Unicode strings (#22479)Mike Taves2022-10-261-1/+1
|/
* Merge pull request #22385 from seberg/deprecate-out-of-bound-pyint-conversionMatti Picus2022-10-111-1/+7
|\ | | | | DEP: Deprecate conversion of out-of-bound Python integers
| * MAINT: Structured MA fill value workaround by adding array castSebastian Berg2022-10-051-1/+7
| | | | | | | | | | | | | | | | | | | | This wraps the fill value into an array, the default fill value for all ointegers is 99999 which doesn't work for many integer dtypes. Note that this might still subtle change the behavior in other code paths where we cannot avoid this. Plus, the deprecationwarning may show up (and in fact be a "in the future will use the default fill value" warning).
* | DOC: added `ma.round` and `ma.round_` examples (#22404)Felix Hirwa Nshuti2022-10-111-0/+22
| | | | | | | | This PR is partially addressing #22269 Added examples for ma.round and ma.round_
* | Merge pull request #22046 from cmarmo/masked-invalidSebastian Berg2022-10-051-13/+1
|\ \ | | | | | | BUG: Make `mask_invalid` consistent with `mask_where` if `copy` is set to `False`
| * | Remove try statement. Add test.Chiara Marmo2022-09-071-4/+1
| | |
| * | Make mask_invalid consistent with mask_where when copy is set to False. Add ↵Chiara Marmo2022-07-251-13/+4
| | | | | | | | | | | | test for type erroring.
* | | Added ma.min examplesFelix Hirwa Nshuti2022-10-011-1/+1
| | |
* | | Added ma.min examplesFelix Hirwa Nshuti2022-10-011-0/+30
| |/ |/|
* | DOC: Adding examples to `ma.max` function (#22331)Felix Hirwa Nshuti2022-09-271-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add examples to ma.max function * indent fix Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net> * Indententation fixes * Indent fixes Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net> * Indent fixes Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net> * Added example that gives masked array * fix output indent * Update numpy/ma/core.py * Update numpy/ma/core.py Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
* | Remove long deprecated functionality from np.maBrigitta Sipőcz2022-09-081-82/+2
|/
* Revert "ENH: Adding __array_ufunc__ capability to MaskedArrays."mattip2022-07-201-180/+40
| | | | This reverts commit 8cd6f4ca00b6e0da3833fc267d50067b2ddbc069.
* Revert "nomask in nomask out" from 21977mattip2022-07-201-2/+2
| | | | This reverts commit db1a98bf194771a677dbc0c2e06bc47f4a9947a8.
* Revert "BUG: fix ma.minimum.reduce with axis keyword"mattip2022-07-201-2/+0
| | | | This reverts commit b8c6d09208ecb7f0d83a8b06ab9e15e720f03730.
* BUG: fix ma.minimum.reduce with axis keywordRuth Comer2022-07-161-0/+2
| | | | | | | | | | | Fixes the problem reported at https://github.com/numpy/numpy/pull/21977#issuecomment-1186082534 The reduce method here effectively calls itself with an unmasked MaskedArray (mask=nomask) and then expects either a MaskedArray or a scalar. This change ensures that an ordinary ndarray is converted to a MaskedArray, following the pattern already used in mean and var in this module.
* nomask in nomask outRuth Comer2022-07-131-2/+2
|
* ENH: Adding __array_ufunc__ capability to MaskedArrays.Greg Lucas2022-07-131-40/+180
| | | | | | This enables any ufunc numpy operations that are called on a MaskedArray to use the masked version of that function automatically without needing to resort to np.ma.func() calls.
* Revert "ENH: Adding __array_ufunc__ capability to MaskedArrays"Matti Picus2022-07-091-180/+40
|
* ENH: Adding __array_ufunc__ capability to MaskedArrays.Greg Lucas2022-06-291-40/+180
| | | | | | This enables any ufunc numpy operations that are called on a MaskedArray to use the masked version of that function automatically without needing to resort to np.ma.func() calls.
* API: Define `<`, `<=`, `>`, `>=` for masked arraysSebastian Berg2022-06-211-1/+19
| | | | | | | | | | This defines the comparison operators (other than `==` and `!=`) explicitly for masked arrays. The mask is ignored for the resuling `res._data` (unlike `==` and `!=` which take the mask into account. Closes gh-21770, although the way that masked arrays propagate the fill-value seems generally broken and error prone.
* Merge pull request #20914 from kinshukdua/fix_ma_meanMatti Picus2022-06-121-1/+10
|\ | | | | BUG: change `ma.mean` dtype to be consistent with `np.mean`
| * BUG: change `ma.mean` dtype to be consistent with `np.mean`Kinshuk Dua2022-01-271-1/+10
| |
* | MAINT: Fortify masked in-place ops against promotion warningsSebastian Berg2022-05-271-18/+24
| | | | | | | | | | | | These warnings are probably optional in the future. They should not matter much (since the following is an in-place op), but the `np.where` could upcast currently!
* | Add space after argument nameOscar Gustafsson2022-04-031-6/+6
| |
* | DOC: Restore MaskedArray.hardmask documentation (#20810)Hans Meine2022-01-181-8/+51
| |
* | DEP: remove NPY_ARRAY_UPDATEIFCOPY, deprecated in 1.14 (#20589)Matti Picus2021-12-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | * DEP: remove NPY_ARRAY_UPDATEIFCOPY, deprecated in 1.14 * remove more UPDATEIFCOPY * typo: add missing comma * remove a few more UPDATEIFCOPY * Add release note * remove UPDATEIFCOPY from comment (from review)