diff options
-rw-r--r-- | numpy/ma/core.py | 2 | ||||
-rw-r--r-- | numpy/ma/tests/test_core.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index acf1a0444..5fb16d0cb 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -4656,7 +4656,7 @@ class MaskedArray(ndarray): # TODO: We don't actually support K, so use A instead. We could # try to guess this correct by sorting strides or deprecate. if order in "kKaA": - order = "C" if self._data.flags.fnc else "F" + order = "F" if self._data.flags.fnc else "C" r = ndarray.ravel(self._data, order=order).view(type(self)) r._update_from(self) if self._mask is not nomask: diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index 6c03e0ba2..722b3ded4 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -3441,6 +3441,8 @@ class TestMaskedArrayMethods: raveled = x.ravel(order) assert (raveled.filled(0) == 0).all() + # NOTE: Can be wrong if arr order is neither C nor F and `order="K"` + assert_array_equal(arr.ravel(order), x.ravel(order)._data) def test_reshape(self): # Tests reshape |