From c7bc34acb6f0a82ea04ab02a6722dd772cbb9d7d Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Sat, 4 Dec 2021 10:42:13 -0800 Subject: [PATCH] DOC: Uniform block directive syntax. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit block directive syntax technically does not have space before the double-colon. While this seem to be accepted by docutils – but not documented, this can throw off other RST parser/syntax highlighter. Sometime they can see that as comments, sometime they give garbage out. Plus this is really uncommon with 3 occurrences in pandas codebase with space and 4800 without: pandas[master] $ rg '\.\. \w+::' | wc -l 4853 Numpy and scipy used to have a few space in their block directive, but current master/main branch of both should also be free of directive with space before the double colon. --- .pre-commit-config.yaml | 2 ++ doc/source/user_guide/io.rst | 4 ++-- pandas/core/algorithms.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f6f46299e277d..ea15e135455ba 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -111,6 +111,8 @@ repos: # Incorrect code-block / IPython directives |\.\.\ code-block\ :: |\.\.\ ipython\ :: + # directive should not have a space before :: + |\.\.\ \w+\ :: # Check for deprecated messages without sphinx directive |(DEPRECATED|DEPRECATE|Deprecated)(:|,|\.) diff --git a/doc/source/user_guide/io.rst b/doc/source/user_guide/io.rst index 204706f784fe8..cd7105d125947 100644 --- a/doc/source/user_guide/io.rst +++ b/doc/source/user_guide/io.rst @@ -3546,9 +3546,9 @@ with ``on_demand=True``. Specifying sheets +++++++++++++++++ -.. note :: The second argument is ``sheet_name``, not to be confused with ``ExcelFile.sheet_names``. +.. note:: The second argument is ``sheet_name``, not to be confused with ``ExcelFile.sheet_names``. -.. note :: An ExcelFile's attribute ``sheet_names`` provides access to a list of sheets. +.. note:: An ExcelFile's attribute ``sheet_names`` provides access to a list of sheets. * The arguments ``sheet_name`` allows specifying the sheet or sheets to read. * The default value for ``sheet_name`` is 0, indicating to read the first sheet diff --git a/pandas/core/algorithms.py b/pandas/core/algorithms.py index 538d9b0348d5f..b12e5be7722d0 100644 --- a/pandas/core/algorithms.py +++ b/pandas/core/algorithms.py @@ -633,7 +633,7 @@ def factorize( is a Categorical. When `values` is some other pandas object, an `Index` is returned. Otherwise, a 1-D ndarray is returned. - .. note :: + .. note:: Even if there's a missing value in `values`, `uniques` will *not* contain an entry for it.