diff --git a/doc/source/basics.rst b/doc/source/basics.rst index 38828d5623536..bb65312f053f3 100644 --- a/doc/source/basics.rst +++ b/doc/source/basics.rst @@ -509,9 +509,6 @@ arguments. The special value ``all`` can also be used: That feature relies on :ref:`select_dtypes `. Refer to there for details about accepted inputs. -There also is a utility function, ``value_range`` which takes a DataFrame and -returns a series with the minimum/maximum values in the DataFrame. - .. _basics.idxmin: Index of Min/Max Values diff --git a/doc/source/v0.15.0.txt b/doc/source/v0.15.0.txt index 6b2d2b6aad490..ef8e7b975eea4 100644 --- a/doc/source/v0.15.0.txt +++ b/doc/source/v0.15.0.txt @@ -772,6 +772,7 @@ Deprecations ``ambiguous`` to allow for more flexibility in dealing with DST transitions. Replace ``infer_dst=True`` with ``ambiguous='infer'`` for the same behavior (:issue:`7943`). See :ref:`the docs` for more details. +- The top-level ``pd.value_range`` has been deprecated and can be replaced by ``.describe()`` (:issue:`8481`) .. _whatsnew_0150.index_set_ops: diff --git a/pandas/__init__.py b/pandas/__init__.py index df5e6f567e3a6..69e8a4bad377e 100644 --- a/pandas/__init__.py +++ b/pandas/__init__.py @@ -53,11 +53,13 @@ from pandas.io.api import * from pandas.computation.api import * -from pandas.tools.describe import value_range from pandas.tools.merge import merge, concat, ordered_merge from pandas.tools.pivot import pivot_table, crosstab from pandas.tools.plotting import scatter_matrix, plot_params from pandas.tools.tile import cut, qcut +from pandas.tools.util import value_range from pandas.core.reshape import melt from pandas.util.print_versions import show_versions import pandas.util.testing + + diff --git a/pandas/tools/describe.py b/pandas/tools/describe.py deleted file mode 100644 index eca5a800b3c6c..0000000000000 --- a/pandas/tools/describe.py +++ /dev/null @@ -1,17 +0,0 @@ -from pandas.core.series import Series - - -def value_range(df): - """ - Return the minimum and maximum of a dataframe in a series object - - Parameters - ---------- - df : DataFrame - - Returns - ------- - (maximum, minimum) : Series - - """ - return Series((min(df.min()), max(df.max())), ('Minimum', 'Maximum')) diff --git a/pandas/tools/tests/test_tools.py b/pandas/tools/tests/test_tools.py deleted file mode 100644 index 4fd70e28497a8..0000000000000 --- a/pandas/tools/tests/test_tools.py +++ /dev/null @@ -1,23 +0,0 @@ -from pandas import DataFrame -from pandas.tools.describe import value_range - -import numpy as np -import pandas.util.testing as tm - - -class TestTools(tm.TestCase): - - def test_value_range(self): - df = DataFrame(np.random.randn(5, 5)) - df.ix[0, 2] = -5 - df.ix[2, 0] = 5 - - res = value_range(df) - - self.assertEqual(res['Minimum'], -5) - self.assertEqual(res['Maximum'], 5) - - df.ix[0, 1] = np.NaN - - self.assertEqual(res['Minimum'], -5) - self.assertEqual(res['Maximum'], 5) diff --git a/pandas/tools/util.py b/pandas/tools/util.py index 215a76b84452a..72fdeaff36ef1 100644 --- a/pandas/tools/util.py +++ b/pandas/tools/util.py @@ -1,4 +1,5 @@ import operator +import warnings from pandas.compat import reduce from pandas.core.index import Index import numpy as np @@ -47,3 +48,22 @@ def compose(*funcs): """Compose 2 or more callables""" assert len(funcs) > 1, 'At least 2 callables must be passed to compose' return reduce(_compose2, funcs) + +### FIXME: remove in 0.16 +def value_range(df): + """ + Return the minimum and maximum of a dataframe in a series object + + Parameters + ---------- + df : DataFrame + + Returns + ------- + (maximum, minimum) : Series + + """ + from pandas import Series + warnings.warn("value_range is deprecated. Use .describe() instead", FutureWarning) + + return Series((min(df.min()), max(df.max())), ('Minimum', 'Maximum'))