diff --git a/docs/cudf/source/conf.py b/docs/cudf/source/conf.py index 0ffbdf47d54..e9fd29ce859 100644 --- a/docs/cudf/source/conf.py +++ b/docs/cudf/source/conf.py @@ -22,6 +22,7 @@ from docutils.nodes import Text from sphinx.addnodes import pending_xref + import cudf sys.path.insert(0, os.path.abspath(cudf.__path__[0])) @@ -200,6 +201,7 @@ "python": ("https://docs.python.org/3", None), "cupy": ("https://docs.cupy.dev/en/stable/", None), "numpy": ("https://numpy.org/doc/stable", None), + "pyarrow": ("https://arrow.apache.org/docs/", None), } # Config numpydoc @@ -235,10 +237,17 @@ def resolve_aliases(app, doctree): def ignore_internal_references(app, env, node, contnode): name = node.get("reftarget", None) - if name is not None and name in _internal_names_to_ignore: + if name == "cudf.core.index.GenericIndex": + # We don't exposed docs for `cudf.core.index.GenericIndex` + # hence we would want the docstring & mypy references to + # use `cudf.Index` + node["reftarget"] = "cudf.Index" + return contnode + elif name is not None and name in _internal_names_to_ignore: node["reftarget"] = "" return contnode + def process_class_docstrings(app, what, name, obj, options, lines): """ For those classes for which we use :: @@ -258,7 +267,6 @@ def process_class_docstrings(app, what, name, obj, options, lines): nitpick_ignore = [("py:class", "SeriesOrIndex"),] - def setup(app): app.add_css_file("params.css") app.connect("doctree-read", resolve_aliases) diff --git a/python/cudf/cudf/core/_base_index.py b/python/cudf/cudf/core/_base_index.py index 8dbd71739b5..031dd58478b 100644 --- a/python/cudf/cudf/core/_base_index.py +++ b/python/cudf/cudf/core/_base_index.py @@ -41,8 +41,8 @@ Parameters ---------- -dtype : numpy dtype - Use a numpy.dtype to cast entire Index object to. +dtype : :class:`numpy.dtype` + Use a :class:`numpy.dtype` to cast entire Index object to. copy : bool, default False By default, astype always returns a newly allocated object. If copy is set to False and internal requirements on dtype are diff --git a/python/cudf/cudf/core/column/string.py b/python/cudf/cudf/core/column/string.py index c9665b51951..edb27cc3473 100644 --- a/python/cudf/cudf/core/column/string.py +++ b/python/cudf/cudf/core/column/string.py @@ -34,7 +34,7 @@ ) from cudf.core.buffer import Buffer from cudf.core.column import column, datetime -from cudf.core.column.methods import ColumnMethods, ParentType +from cudf.core.column.methods import ColumnMethods from cudf.utils.docutils import copy_docstring from cudf.utils.dtypes import can_convert_to_column @@ -159,7 +159,7 @@ def htoi(self) -> SeriesOrIndex: hex_to_int = htoi - def ip2int(self) -> ParentType: + def ip2int(self) -> SeriesOrIndex: """ This converts ip strings to integers @@ -4950,7 +4950,7 @@ def edit_distance(self, targets) -> SeriesOrIndex: libstrings.edit_distance(self._column, targets_column) ) - def edit_distance_matrix(self) -> ParentType: + def edit_distance_matrix(self) -> SeriesOrIndex: """Computes the edit distance between strings in the series. The series to compute the matrix should have more than 2 strings and diff --git a/python/cudf/cudf/core/frame.py b/python/cudf/cudf/core/frame.py index ab5fa2c3d0b..754d14278ce 100644 --- a/python/cudf/cudf/core/frame.py +++ b/python/cudf/cudf/core/frame.py @@ -537,7 +537,7 @@ def to_cupy( Parameters ---------- - dtype : str or numpy.dtype, optional + dtype : str or :class:`numpy.dtype`, optional The dtype to pass to :func:`numpy.asarray`. copy : bool, default False Whether to ensure that the returned value is not a view on @@ -572,7 +572,7 @@ def to_numpy( Parameters ---------- - dtype : str or numpy.dtype, optional + dtype : str or :class:`numpy.dtype`, optional The dtype to pass to :func:`numpy.asarray`. copy : bool, default True Whether to ensure that the returned value is not a view on diff --git a/python/cudf/cudf/core/groupby/groupby.py b/python/cudf/cudf/core/groupby/groupby.py index 013ae7ad033..a6cbdc74c37 100644 --- a/python/cudf/cudf/core/groupby/groupby.py +++ b/python/cudf/cudf/core/groupby/groupby.py @@ -809,7 +809,7 @@ def transform(self, function): See also -------- - cudf.core.groupby.GroupBy.agg + agg """ try: result = self.agg(function) diff --git a/python/cudf/cudf/core/index.py b/python/cudf/cudf/core/index.py index 37039a009ca..e9a606ac0b5 100644 --- a/python/cudf/cudf/core/index.py +++ b/python/cudf/cudf/core/index.py @@ -2146,7 +2146,7 @@ class TimedeltaIndex(GenericIndex): This is not yet supported closed : str, optional This is not yet supported - dtype : str or numpy.dtype, optional + dtype : str or :class:`numpy.dtype`, optional Data type for the output Index. If not specified, the default dtype will be ``timedelta64[ns]``. name : object diff --git a/python/cudf/cudf/core/indexed_frame.py b/python/cudf/cudf/core/indexed_frame.py index 318cb1109de..a962ff5c0ab 100644 --- a/python/cudf/cudf/core/indexed_frame.py +++ b/python/cudf/cudf/core/indexed_frame.py @@ -2348,10 +2348,10 @@ def astype(self, dtype, copy=False, errors="raise", **kwargs): Parameters ---------- dtype : data type, or dict of column name -> data type - Use a numpy.dtype or Python type to cast entire DataFrame object to - the same type. Alternatively, use ``{col: dtype, ...}``, where col - is a column label and dtype is a numpy.dtype or Python type - to cast one or more of the DataFrame's columns to + Use a :class:`numpy.dtype` or Python type to cast entire DataFrame + object to the same type. Alternatively, use ``{col: dtype, ...}``, + where col is a column label and dtype is a :class:`numpy.dtype` + or Python type to cast one or more of the DataFrame's columns to column-specific types. copy : bool, default False Return a deep-copy when ``copy=True``. Note by default diff --git a/python/cudf/cudf/core/series.py b/python/cudf/cudf/core/series.py index c1692187c3b..9c89739a73a 100644 --- a/python/cudf/cudf/core/series.py +++ b/python/cudf/cudf/core/series.py @@ -266,7 +266,7 @@ class Series(SingleColumnFrame, IndexedFrame, Serializable): If both a dict and index sequence are used, the index will override the keys found in the dict. - dtype : str, numpy.dtype, or ExtensionDtype, optional + dtype : str, :class:`numpy.dtype`, or ExtensionDtype, optional Data type for the output Series. If not specified, this will be inferred from data. @@ -2129,7 +2129,7 @@ def applymap(self, udf, out_dtype=None): Either a callable python function or a python function already decorated by ``numba.cuda.jit`` for call on the GPU as a device - out_dtype : numpy.dtype; optional + out_dtype : :class:`numpy.dtype`; optional The dtype for use in the output. Only used for ``numba.cuda.jit`` decorated udf. By default, the result will have the same dtype as the source.