diff --git a/doc/source/development/contributing.rst b/doc/source/development/contributing.rst index 1073959de4456..d02896f777348 100644 --- a/doc/source/development/contributing.rst +++ b/doc/source/development/contributing.rst @@ -110,7 +110,7 @@ version control to allow many people to work together on the project. Some great resources for learning Git: * the `GitHub help pages `_. -* the `NumPy's documentation `_. +* the `NumPy's documentation `_. * Matthew Brett's `Pydagogue `_. Getting started with Git @@ -974,7 +974,7 @@ it is worth getting in the habit of writing tests ahead of time so this is never Like many packages, pandas uses `pytest `_ and the convenient extensions in `numpy.testing -`_. +`_. .. note:: diff --git a/doc/source/development/extending.rst b/doc/source/development/extending.rst index d9fb2643e8a1a..1e6b2c646fdfd 100644 --- a/doc/source/development/extending.rst +++ b/doc/source/development/extending.rst @@ -219,7 +219,7 @@ and re-boxes it if necessary. If applicable, we highly recommend that you implement ``__array_ufunc__`` in your extension array to avoid coercion to an ndarray. See -`the numpy documentation `__ +`the numpy documentation `__ for an example. As part of your implementation, we require that you defer to pandas when a pandas diff --git a/doc/source/user_guide/basics.rst b/doc/source/user_guide/basics.rst index 0621cd20b8df9..91729fb08bd3a 100644 --- a/doc/source/user_guide/basics.rst +++ b/doc/source/user_guide/basics.rst @@ -2385,7 +2385,7 @@ For example, to select ``bool`` columns: df.select_dtypes(include=[bool]) You can also pass the name of a dtype in the `NumPy dtype hierarchy -`__: +`__: .. ipython:: python diff --git a/doc/source/user_guide/dsintro.rst b/doc/source/user_guide/dsintro.rst index 075787d3b9d5b..360a14998b227 100644 --- a/doc/source/user_guide/dsintro.rst +++ b/doc/source/user_guide/dsintro.rst @@ -273,7 +273,7 @@ pandas object. Like Series, DataFrame accepts many different kinds of input: * Dict of 1D ndarrays, lists, dicts, or Series * 2-D numpy.ndarray * `Structured or record - `__ ndarray + `__ ndarray * A ``Series`` * Another ``DataFrame`` @@ -632,7 +632,7 @@ union of the column and row labels. When doing an operation between DataFrame and Series, the default behavior is to align the Series **index** on the DataFrame **columns**, thus `broadcasting -`__ +`__ row-wise. For example: .. ipython:: python @@ -718,7 +718,7 @@ indexing semantics and data model are quite different in places from an n-dimens array. :class:`Series` implements ``__array_ufunc__``, which allows it to work with NumPy's -`universal functions `_. +`universal functions `_. The ufunc is applied to the underlying array in a Series. diff --git a/doc/source/user_guide/gotchas.rst b/doc/source/user_guide/gotchas.rst index 4c691ebb252e7..e0f6c7570074b 100644 --- a/doc/source/user_guide/gotchas.rst +++ b/doc/source/user_guide/gotchas.rst @@ -339,5 +339,5 @@ constructors using something similar to the following: s = pd.Series(newx) See `the NumPy documentation on byte order -`__ for more +`__ for more details. diff --git a/doc/source/user_guide/sparse.rst b/doc/source/user_guide/sparse.rst index 8588fac4a18d0..ca8e9a2f313f6 100644 --- a/doc/source/user_guide/sparse.rst +++ b/doc/source/user_guide/sparse.rst @@ -139,7 +139,7 @@ See :ref:`api.frame.sparse` for more. Sparse calculation ------------------ -You can apply NumPy `ufuncs `_ +You can apply NumPy `ufuncs `_ to ``SparseArray`` and get a ``SparseArray`` as a result. .. ipython:: python diff --git a/doc/source/whatsnew/v0.19.0.rst b/doc/source/whatsnew/v0.19.0.rst index 2d3bb7056b75a..6e8c4273a0550 100644 --- a/doc/source/whatsnew/v0.19.0.rst +++ b/doc/source/whatsnew/v0.19.0.rst @@ -390,7 +390,7 @@ Fine-grained NumPy errstate Previous versions of pandas would permanently silence numpy's ufunc error handling when ``pandas`` was imported. Pandas did this in order to silence the warnings that would arise from using numpy ufuncs on missing data, which are usually represented as ``NaN`` s. Unfortunately, this silenced legitimate warnings arising in non-pandas code in the application. Starting with 0.19.0, pandas will use the ``numpy.errstate`` context manager to silence these warnings in a more fine-grained manner, only around where these operations are actually used in the pandas code base. (:issue:`13109`, :issue:`13145`) -After upgrading pandas, you may see *new* ``RuntimeWarnings`` being issued from your code. These are likely legitimate, and the underlying cause likely existed in the code when using previous versions of pandas that simply silenced the warning. Use `numpy.errstate `__ around the source of the ``RuntimeWarning`` to control how these conditions are handled. +After upgrading pandas, you may see *new* ``RuntimeWarnings`` being issued from your code. These are likely legitimate, and the underlying cause likely existed in the code when using previous versions of pandas that simply silenced the warning. Use `numpy.errstate `__ around the source of the ``RuntimeWarning`` to control how these conditions are handled. .. _whatsnew_0190.get_dummies_dtypes: diff --git a/pandas/_libs/testing.pyx b/pandas/_libs/testing.pyx index c6b8c3e876390..0460a69f366c4 100644 --- a/pandas/_libs/testing.pyx +++ b/pandas/_libs/testing.pyx @@ -40,8 +40,7 @@ cdef bint is_dictlike(obj): cdef bint decimal_almost_equal(double desired, double actual, int decimal): # Code from - # http://docs.scipy.org/doc/numpy/reference/generated - # /numpy.testing.assert_almost_equal.html + # https://numpy.org/doc/stable/reference/generated/numpy.testing.assert_almost_equal.html return abs(desired - actual) < (0.5 * 10.0 ** -decimal) diff --git a/pandas/core/arrays/numpy_.py b/pandas/core/arrays/numpy_.py index b9384aa1bb092..f6dfb1f0f1e62 100644 --- a/pandas/core/arrays/numpy_.py +++ b/pandas/core/arrays/numpy_.py @@ -214,8 +214,7 @@ def __array__(self, dtype=None) -> np.ndarray: def __array_ufunc__(self, ufunc, method: str, *inputs, **kwargs): # Lightly modified version of - # https://docs.scipy.org/doc/numpy-1.15.1/reference/generated/\ - # numpy.lib.mixins.NDArrayOperatorsMixin.html + # https://numpy.org/doc/stable/reference/generated/numpy.lib.mixins.NDArrayOperatorsMixin.html # The primary modification is not boxing scalar return values # in PandasArray, since pandas' ExtensionArrays are 1-d. out = kwargs.get("out", ()) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 4e86b3710a1bd..0d5a02aa4ea7a 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -3360,7 +3360,7 @@ def select_dtypes(self, include=None, exclude=None) -> "DataFrame": * To select strings you must use the ``object`` dtype, but note that this will return *all* object dtype columns * See the `numpy dtype hierarchy - `__ + `__ * To select datetimes, use ``np.datetime64``, ``'datetime'`` or ``'datetime64'`` * To select timedeltas, use ``np.timedelta64``, ``'timedelta'`` or diff --git a/pandas/tests/indexes/multi/test_analytics.py b/pandas/tests/indexes/multi/test_analytics.py index cd98a87459061..154ed22214830 100644 --- a/pandas/tests/indexes/multi/test_analytics.py +++ b/pandas/tests/indexes/multi/test_analytics.py @@ -232,7 +232,7 @@ def test_map_dictlike(idx, mapper): ) def test_numpy_ufuncs(idx, func): # test ufuncs of numpy. see: - # https://docs.scipy.org/doc/numpy/reference/ufuncs.html + # https://numpy.org/doc/stable/reference/ufuncs.html if _np_version_under1p17: expected_exception = AttributeError diff --git a/pandas/tests/indexes/test_numpy_compat.py b/pandas/tests/indexes/test_numpy_compat.py index 8b62de7030096..3340945ca1690 100644 --- a/pandas/tests/indexes/test_numpy_compat.py +++ b/pandas/tests/indexes/test_numpy_compat.py @@ -46,7 +46,7 @@ ) def test_numpy_ufuncs_basic(indices, func): # test ufuncs of numpy, see: - # https://docs.scipy.org/doc/numpy/reference/ufuncs.html + # https://numpy.org/doc/stable/reference/ufuncs.html idx = indices if isinstance(idx, DatetimeIndexOpsMixin): @@ -77,7 +77,7 @@ def test_numpy_ufuncs_basic(indices, func): ) def test_numpy_ufuncs_other(indices, func): # test ufuncs of numpy, see: - # https://docs.scipy.org/doc/numpy/reference/ufuncs.html + # https://numpy.org/doc/stable/reference/ufuncs.html idx = indices if isinstance(idx, (DatetimeIndex, TimedeltaIndex)): diff --git a/web/pandas/community/blog/extension-arrays.md b/web/pandas/community/blog/extension-arrays.md index bc6179adfa719..ea8a9a28ba242 100644 --- a/web/pandas/community/blog/extension-arrays.md +++ b/web/pandas/community/blog/extension-arrays.md @@ -207,7 +207,7 @@ partners][partners] involved in the pandas community. [IntegerArray]: http://pandas.pydata.org/pandas-docs/version/0.24/reference/api/pandas.arrays.IntegerArray.html [fletcher]: https://github.com/xhochy/fletcher [arrow]: https://arrow.apache.org -[ufunc]: https://docs.scipy.org/doc/numpy-1.13.0/neps/ufunc-overrides.html +[ufunc]: https://numpy.org/neps/nep-0013-ufunc-overrides.html [nep18]: https://www.numpy.org/neps/nep-0018-array-function-protocol.html [ml]: https://mail.python.org/mailman/listinfo/pandas-dev [twitter]: https://twitter.com/pandas_dev