-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
DOC: Fixing some doc warnings #26786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
b61adc5
4320155
3ee230d
c51cca9
5646735
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -396,7 +396,7 @@ IntervalIndex | |||||
|
||||||
pandas has gained an ``IntervalIndex`` with its own dtype, ``interval`` as well as the ``Interval`` scalar type. These allow first-class support for interval | ||||||
notation, specifically as a return type for the categories in :func:`cut` and :func:`qcut`. The ``IntervalIndex`` allows some unique indexing, see the | ||||||
:ref:`docs <indexing.intervallindex>`. (:issue:`7640`, :issue:`8625`) | ||||||
:ref:`docs <api.intervalindex>`. (:issue:`7640`, :issue:`8625`) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think the original intent was to refer to the user guide section, which is moved to "advanced.rst" (we actually shouldn't have renamed that label in the first place ..) |
||||||
|
||||||
.. warning:: | ||||||
|
||||||
|
@@ -1564,7 +1564,7 @@ Removal of prior version deprecations/changes | |||||
|
||||||
- The ``pandas.rpy`` module is removed. Similar functionality can be accessed | ||||||
through the `rpy2 <https://rpy2.readthedocs.io/>`__ project. | ||||||
See the :ref:`R interfacing docs <rpy>` for more details. | ||||||
See the :ref:`R interfacing docs <https://pandas.pydata.org/pandas-docs/version/0.20/r_interface.html>`__ for more details. | ||||||
- The ``pandas.io.ga`` module with a ``google-analytics`` interface is removed (:issue:`11308`). | ||||||
Similar functionality can be found in the `Google2Pandas <https://github.com/panalysis/Google2Pandas>`__ package. | ||||||
- ``pd.to_datetime`` and ``pd.to_timedelta`` have dropped the ``coerce`` parameter in favor of ``errors`` (:issue:`13602`) | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10283,8 +10283,8 @@ def _doc_parms(cls): | |
Returns | ||
------- | ||
%(name1)s or %(name2)s (if level specified)\ | ||
%(see_also)s | ||
%(examples)s\ | ||
%(see_also)s\ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have an expectation that substituted sections are responsible for line breaks? I feel like this has caused a few issues throughout code base curious if you have thoughts There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @datapythonista I might already have fixed this one in https://github.com/pandas-dev/pandas/pull/26780/files, but by adding a extra newline in the "see also" string instead of here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is trickier than what it looks, our validation complains if there are two line breaks together, and also a missing line break at the end. And we don't fail the validation, but we get warnings (and incorrect rendering) if the line break is missing before a section title, as the title is not detected. It took me a while to find a working solution for all the cases, I think the one here is the only possible one, there are many docstrings affected by this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I trust you here ;-) I only fixed that single case (of min/max I think), and didn't check the interaction with fixing others. But you might need to revert my change to get it working with master. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the change you did was correct and is still needed, it just didn't address all the cases. |
||
%(examples)s | ||
""" | ||
|
||
_num_ddof_doc = """ | ||
|
@@ -10427,7 +10427,8 @@ def _doc_parms(cls): | |
|
||
Returns | ||
------- | ||
%(name1)s or %(name2)s\n | ||
%(name1)s or %(name2)s | ||
|
||
See Also | ||
-------- | ||
core.window.Expanding.%(accum_func_name)s : Similar functionality | ||
|
@@ -10788,10 +10789,10 @@ def _doc_parms(cls): | |
Series([], dtype: bool) | ||
""" | ||
|
||
_shared_docs['stat_func_example'] = """\ | ||
_shared_docs['stat_func_example'] = """ | ||
|
||
Examples | ||
-------- | ||
|
||
>>> idx = pd.MultiIndex.from_arrays([ | ||
... ['warm', 'warm', 'cold', 'cold'], | ||
... ['dog', 'falcon', 'fish', 'spider']], | ||
|
@@ -10820,8 +10821,7 @@ def _doc_parms(cls): | |
blooded | ||
warm {level_output_0} | ||
cold {level_output_1} | ||
Name: legs, dtype: int64 | ||
""" | ||
Name: legs, dtype: int64""" | ||
|
||
_sum_examples = _shared_docs['stat_func_example'].format( | ||
stat_func='sum', | ||
|
@@ -10831,6 +10831,7 @@ def _doc_parms(cls): | |
level_output_1=8) | ||
|
||
_sum_examples += """ | ||
|
||
By default, the sum of an empty or all-NA Series is ``0``. | ||
|
||
>>> pd.Series([]).sum() # min_count=0 is the default | ||
|
@@ -10849,8 +10850,7 @@ def _doc_parms(cls): | |
0.0 | ||
|
||
>>> pd.Series([np.nan]).sum(min_count=1) | ||
nan | ||
""" | ||
nan""" | ||
|
||
_max_examples = _shared_docs['stat_func_example'].format( | ||
stat_func='max', | ||
|
@@ -10867,6 +10867,7 @@ def _doc_parms(cls): | |
level_output_1=0) | ||
|
||
_stat_func_see_also = """ | ||
|
||
See Also | ||
-------- | ||
Series.sum : Return the sum. | ||
|
@@ -10878,10 +10879,10 @@ def _doc_parms(cls): | |
DataFrame.min : Return the minimum over the requested axis. | ||
DataFrame.max : Return the maximum over the requested axis. | ||
DataFrame.idxmin : Return the index of the minimum over the requested axis. | ||
DataFrame.idxmax : Return the index of the maximum over the requested axis. | ||
""" | ||
DataFrame.idxmax : Return the index of the maximum over the requested axis.""" | ||
|
||
_prod_examples = """ | ||
|
||
_prod_examples = """\ | ||
Examples | ||
-------- | ||
By default, the product of an empty or all-NA Series is ``1`` | ||
|
@@ -10901,8 +10902,7 @@ def _doc_parms(cls): | |
1.0 | ||
|
||
>>> pd.Series([np.nan]).prod(min_count=1) | ||
nan | ||
""" | ||
nan""" | ||
|
||
_min_count_stub = """\ | ||
min_count : int, default 0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,12 +49,6 @@ class RangeIndex(Int64Index): | |
copy : bool, default False | ||
Unused, accepted for homogeneity with other index types. | ||
|
||
Attributes | ||
---------- | ||
start | ||
stop | ||
step | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why remove those? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. those are not actual attributes for what I saw, I'll revert here anyway, and let's take care of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They recently got added as actual attributes, IIRC There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you're right, I think I didn't test in master |
||
|
||
Methods | ||
------- | ||
from_range | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking more closely at the log output and our current docs -> RangeIndex is actually already included in the API docs in the "Numeric Index" above (I think it makes sense to have it in the numeric section)
But the question is then: why did we get those warnings in the current doc build on master. It might be that we need to add the attributes here as well (not fully sure)