numpy.min - python examples

Here are the examples of the python api numpy.min taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

145 Examples 7

3 View Complete Implementation : test_nanops.py
Copyright Apache License 2.0
Author : Frank-qlu
    def _argminmax_wrap(self, value, axis=None, func=None):
        res = func(value, axis)
        nans = np.min(value, axis)
        nullnan = isna(nans)
        if res.ndim:
            res[nullnan] = -1
        elif (hasattr(nullnan, 'all') and nullnan.all() or
              not hasattr(nullnan, 'all') and nullnan):
            res = -1
        return res

3 View Complete Implementation : test_nanops.py
Copyright Apache License 2.0
Author : Frank-qlu
    def _argminmax_wrap(self, value, axis=None, func=None):
        res = func(value, axis)
        nans = np.min(value, axis)
        nullnan = isna(nans)
        if res.ndim:
            res[nullnan] = -1
        elif (hasattr(nullnan, 'all') and nullnan.all() or
              not hasattr(nullnan, 'all') and nullnan):
            res = -1
        return res

3 View Complete Implementation : test_transform.py
Copyright Apache License 2.0
Author : Frank-qlu
@pytest.mark.parametrize('func', [min, max, np.min, np.max, 'first', 'last'])
def test_groupby_transform_timezone_column(func):
    # GH 24198
    ts = pd.to_datetime('now', utc=True).tz_convert('Asia/Singapore')
    result = pd.DataFrame({'end_time': [ts], 'id': [1]})
    result['max_end_time'] = result.groupby('id').end_time.transform(func)
    expected = pd.DataFrame([[ts, 1, ts]], columns=['end_time', 'id',
                                                    'max_end_time'])
    tm.astert_frame_equal(result, expected)

3 View Complete Implementation : test_transform.py
Copyright Apache License 2.0
Author : Frank-qlu
@pytest.mark.parametrize('func', [min, max, np.min, np.max, 'first', 'last'])
def test_groupby_transform_timezone_column(func):
    # GH 24198
    ts = pd.to_datetime('now', utc=True).tz_convert('Asia/Singapore')
    result = pd.DataFrame({'end_time': [ts], 'id': [1]})
    result['max_end_time'] = result.groupby('id').end_time.transform(func)
    expected = pd.DataFrame([[ts, 1, ts]], columns=['end_time', 'id',
                                                    'max_end_time'])
    tm.astert_frame_equal(result, expected)

3 View Complete Implementation : test_defmatrix.py
Copyright Apache License 2.0
Author : Frank-qlu
    def test_min(self):
        x = matrix([[1, 2, 3], [4, 5, 6]])
        astert_equal(x.min(), 1)
        astert_equal(x.min(0), matrix([[1, 2, 3]]))
        astert_equal(x.min(1), matrix([[1], [4]]))

        astert_equal(np.min(x), 1)
        astert_equal(np.min(x, axis=0), matrix([[1, 2, 3]]))
        astert_equal(np.min(x, axis=1), matrix([[1], [4]]))

3 View Complete Implementation : test_path.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : holzschu
@pytest.mark.parametrize('offset', range(-720, 361, 45))
def test_full_arc(offset):
    low = offset
    high = 360 + offset

    path = Path.arc(low, high)
    mins = np.min(path.vertices, axis=0)
    maxs = np.max(path.vertices, axis=0)
    np.testing.astert_allclose(mins, -1)
    astert np.allclose(maxs, 1)

3 View Complete Implementation : test_nanops.py
Copyright Apache License 2.0
Author : Frank-qlu
    def test_nanmin(self):
        with warnings.catch_warnings(record=True):
            warnings.simplefilter("ignore", RuntimeWarning)
            func = partial(self._minmax_wrap, func=np.min)
            self.check_funs(nanops.nanmin, func,
                            allow_str=False, allow_obj=False)

3 View Complete Implementation : test_nanops.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : holzschu
    def _argminmax_wrap(self, value, axis=None, func=None):
        res = func(value, axis)
        nans = np.min(value, axis)
        nullnan = isna(nans)
        if res.ndim:
            res[nullnan] = -1
        elif (hasattr(nullnan, 'all') and nullnan.all() or
              not hasattr(nullnan, 'all') and nullnan):
            res = -1
        return res

3 View Complete Implementation : test_path.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : holzschu
@pytest.mark.parametrize('offset', range(-720, 361, 45))
def test_full_arc(offset):
    low = offset
    high = 360 + offset

    path = Path.arc(low, high)
    mins = np.min(path.vertices, axis=0)
    maxs = np.max(path.vertices, axis=0)
    np.testing.astert_allclose(mins, -1)
    astert np.allclose(maxs, 1)

3 View Complete Implementation : test_defmatrix.py
Copyright Apache License 2.0
Author : Frank-qlu
    def test_min(self):
        x = matrix([[1, 2, 3], [4, 5, 6]])
        astert_equal(x.min(), 1)
        astert_equal(x.min(0), matrix([[1, 2, 3]]))
        astert_equal(x.min(1), matrix([[1], [4]]))

        astert_equal(np.min(x), 1)
        astert_equal(np.min(x, axis=0), matrix([[1, 2, 3]]))
        astert_equal(np.min(x, axis=1), matrix([[1], [4]]))