From c396d44a23fc485cb0a1994cd12dc44582e3e796 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Fri, 14 Jun 2019 12:43:29 +0100 Subject: [PATCH 1/3] DOC: Fixing even more warnings (not many left) --- doc/source/index.rst.template | 6 ++---- doc/source/whatsnew/v0.17.1.rst | 2 +- doc/source/whatsnew/v0.20.0.rst | 4 ++-- doc/source/whatsnew/v0.25.0.rst | 2 +- pandas/core/indexes/base.py | 12 ++++++++++++ 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/doc/source/index.rst.template b/doc/source/index.rst.template index f18c61b5e2f95..b57ce83cfc33c 100644 --- a/doc/source/index.rst.template +++ b/doc/source/index.rst.template @@ -38,8 +38,7 @@ See the :ref:`overview` for more detail about what's in the library. :maxdepth: 3 :hidden: {% endif %} - - {% if not single_doc -%} +{% if not single_doc %} What's New in 0.25.0 install getting_started/index @@ -52,8 +51,7 @@ See the :ref:`overview` for more detail about what's in the library. {% if not single_doc -%} development/index whatsnew/index -{% endif -%} - +{% endif %} * :doc:`whatsnew/v0.25.0` * :doc:`install` diff --git a/doc/source/whatsnew/v0.17.1.rst b/doc/source/whatsnew/v0.17.1.rst index c4dc442bd7354..9de49699b9652 100644 --- a/doc/source/whatsnew/v0.17.1.rst +++ b/doc/source/whatsnew/v0.17.1.rst @@ -61,7 +61,7 @@ We can render the HTML to get the following table. :file: whatsnew_0171_html_table.html :class:`~pandas.core.style.Styler` interacts nicely with the Jupyter Notebook. -See the :ref:`documentation ` for more. +See the :ref:`documentation ` for more. .. _whatsnew_0171.enhancements: diff --git a/doc/source/whatsnew/v0.20.0.rst b/doc/source/whatsnew/v0.20.0.rst index 8e6ad07ec8435..51c8c488fb9d9 100644 --- a/doc/source/whatsnew/v0.20.0.rst +++ b/doc/source/whatsnew/v0.20.0.rst @@ -387,7 +387,7 @@ For example, after running the following, ``styled.xlsx`` renders as below: import os os.remove('styled.xlsx') -See the :ref:`Style documentation ` for more detail. +See the :ref:`Style documentation ` for more detail. .. _whatsnew_0200.enhancements.intervalindex: @@ -497,7 +497,7 @@ Other Enhancements - ``DataFrame.to_excel()`` has a new ``freeze_panes`` parameter to turn on Freeze Panes when exporting to Excel (:issue:`15160`) - ``pd.read_html()`` will parse multiple header rows, creating a MutliIndex header. (:issue:`13434`). - HTML table output skips ``colspan`` or ``rowspan`` attribute if equal to 1. (:issue:`15403`) -- :class:`pandas.io.formats.style.Styler` template now has blocks for easier extension, see the :ref:`example notebook ` (:issue:`15649`) +- :class:`pandas.io.formats.style.Styler` template now has blocks for easier extension, see the :ref:`example notebook ` (:issue:`15649`) - :meth:`Styler.render() ` now accepts ``**kwargs`` to allow user-defined variables in the template (:issue:`15649`) - Compatibility with Jupyter notebook 5.0; MultiIndex column labels are left-aligned and MultiIndex row-labels are top-aligned (:issue:`15379`) - ``TimedeltaIndex`` now has a custom date-tick formatter specifically designed for nanosecond level precision (:issue:`8711`) diff --git a/doc/source/whatsnew/v0.25.0.rst b/doc/source/whatsnew/v0.25.0.rst index fd47ca14dc788..59544a4167b7c 100644 --- a/doc/source/whatsnew/v0.25.0.rst +++ b/doc/source/whatsnew/v0.25.0.rst @@ -283,7 +283,7 @@ of ``object`` dtype. :attr:`Series.str` will now infer the dtype data *within* t s s.str.startswith(b'a') -.. _whatsnew_0250.api_breaking.incompatible_index_unions +.. _whatsnew_0250.api_breaking.incompatible_index_unions: Incompatible Index Type Unions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 4fb9c4197109f..a4ccdedc9e6e0 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -1411,6 +1411,9 @@ def rename(self, name, inplace=False): @property def nlevels(self): + """ + Number of levels. + """ return 1 def _sort_levels_monotonic(self): @@ -1740,6 +1743,9 @@ def is_mixed(self): return self.inferred_type in ['mixed'] def holds_integer(self): + """ + Whether the type is an integer type. + """ return self.inferred_type in ['integer', 'mixed-integer'] @cache_readonly @@ -3966,6 +3972,9 @@ def _is_memory_usage_qualified(self): return self.is_object() def is_type_compatible(self, kind): + """ + Whether the index type is compatible with the provided type. + """ return kind == self.inferred_type _index_shared_docs['contains'] = """ @@ -4338,6 +4347,9 @@ def sort_values(self, return_indexer=False, ascending=True): return sorted_index def sort(self, *args, **kwargs): + """ + Use sort_values instead. + """ raise TypeError("cannot sort an Index object in-place, use " "sort_values instead") From ba2b6ce896cf3533e65bc56742fc3bc6d0e97cfa Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Fri, 14 Jun 2019 14:54:19 +0200 Subject: [PATCH 2/3] remove attributes that were not generated automatically (no docstring page to link to) --- doc/source/reference/index.rst | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/doc/source/reference/index.rst b/doc/source/reference/index.rst index 31b493e472099..e14b935414bf1 100644 --- a/doc/source/reference/index.rst +++ b/doc/source/reference/index.rst @@ -50,7 +50,6 @@ public functions related to data types in pandas. api/pandas.DataFrame.blocks api/pandas.DataFrame.as_matrix api/pandas.DataFrame.ix - api/pandas.Index.asi8 api/pandas.Index.data api/pandas.Index.flags api/pandas.Index.holds_integer @@ -63,12 +62,3 @@ public functions related to data types in pandas. api/pandas.Series.ix api/pandas.Series.imag api/pandas.Series.real - - -.. Can't convince sphinx to generate toctree for this class attribute. -.. So we do it manually to avoid a warning - -.. - .. toctree:: - - api/pandas.api.extensions.ExtensionDtype.na_value From 9d104dda7c4fdfead50fcaf8a83548fb1a3d50fe Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Fri, 14 Jun 2019 15:54:25 +0200 Subject: [PATCH 3/3] Revert "remove attributes that were not generated automatically (no docstring page to link to)" This reverts commit ba2b6ce896cf3533e65bc56742fc3bc6d0e97cfa. --- doc/source/reference/index.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/source/reference/index.rst b/doc/source/reference/index.rst index e14b935414bf1..31b493e472099 100644 --- a/doc/source/reference/index.rst +++ b/doc/source/reference/index.rst @@ -50,6 +50,7 @@ public functions related to data types in pandas. api/pandas.DataFrame.blocks api/pandas.DataFrame.as_matrix api/pandas.DataFrame.ix + api/pandas.Index.asi8 api/pandas.Index.data api/pandas.Index.flags api/pandas.Index.holds_integer @@ -62,3 +63,12 @@ public functions related to data types in pandas. api/pandas.Series.ix api/pandas.Series.imag api/pandas.Series.real + + +.. Can't convince sphinx to generate toctree for this class attribute. +.. So we do it manually to avoid a warning + +.. + .. toctree:: + + api/pandas.api.extensions.ExtensionDtype.na_value