-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
DOC: document subclasses in API docs with selection of specific methods/attributes #18202
Changes from 9 commits
500ab71
257fc8a
d59c0b5
cb57504
5e4cf6d
346a73b
b5902ff
af1e866
874aefe
32c2816
38673bd
e30335e
38efdcb
5e8bcbe
8695727
4476a5f
a5005e1
aa92592
8841035
1527cdb
7ca3434
5a0e10e
c8504d1
f7ed015
094f6f6
1c2160f
6e99be2
3bd03db
ba257cc
169e833
f846713
141107a
3a224be
34834fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,13 +42,6 @@ def mangle_docstrings(app, what, name, obj, options, lines, | |
class_members_toctree=app.config.numpydoc_class_members_toctree, | ||
) | ||
|
||
# PANDAS HACK (to remove the list of methods/attributes for Categorical) | ||
no_autosummary = [".Categorical", "CategoricalIndex", "IntervalIndex", | ||
"RangeIndex", "Int64Index", "UInt64Index", | ||
"Float64Index", "PeriodIndex", "CategoricalDtype"] | ||
if what == "class" and any(name.endswith(n) for n in no_autosummary): | ||
cfg['class_members_list'] = False | ||
|
||
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 there is also some other code related to this hack that then could be removed (eg the place where I define the 'class_members_list' config). See cf40991 that added it |
||
if what == 'module': | ||
# Strip top title | ||
title_re = re.compile(sixu('^\\s*[#*=]{4,}\\n[a-z0-9 -]+\\n[#*=]{4,}\\s*'), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,25 @@ class CategoricalIndex(Index, accessor.PandasDelegate): | |
See Also | ||
-------- | ||
Categorical, Index | ||
|
||
Methods | ||
------- | ||
rename_categories | ||
reorder_categories | ||
add_categories | ||
remove_categories | ||
remove_unused_categories | ||
set_categories | ||
as_ordered | ||
as_unordered | ||
get_loc | ||
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. Mentioned above as well: is there something categorical-specific about get_loc ? (the map is fine, that has indeed some specifics that are useful) 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 just saw that the example mentioned CategoricalIndex specifically. Looks pretty similar though, so I'll remove it. |
||
map | ||
|
||
Attributes | ||
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. Attributes before Methods? 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. Fixed all these |
||
---------- | ||
codes | ||
categories | ||
ordered | ||
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. Ideally we would add here a sentence with something like "For all other methods, see Index", but I am not sure that is allowed in Attributes / Methods sections? 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 suspect not. I've been thinking of ways to handle this. I'm not worried about people reading the source / in IPython. They already have the code or object. I think in the |
||
""" | ||
|
||
_typ = 'categoricalindex' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,6 +160,37 @@ class PeriodIndex(DatelikeOps, DatetimeIndexOpsMixin, Int64Index): | |
Timezone for converting datetime64 data to Periods | ||
dtype : str or PeriodDtype, default None | ||
|
||
Attributes | ||
---------- | ||
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. hmm maybe we can auto gen these? |
||
day | ||
dayofweek | ||
dayofyear | ||
days_in_month | ||
daysinmonth | ||
end_time | ||
freq | ||
freqstr | ||
hour | ||
is_leap_year | ||
minute | ||
month | ||
quarter | ||
qyear | ||
second | ||
start_time | ||
week | ||
weekday | ||
weekofyear | ||
year | ||
|
||
Methods | ||
------- | ||
asfreq | ||
strftime | ||
to_timestamp | ||
tz_convert | ||
tz_localize | ||
|
||
Examples | ||
-------- | ||
>>> idx = PeriodIndex(year=year_arr, quarter=q_arr) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,10 @@ class RangeIndex(Int64Index): | |
-------- | ||
Index : The base pandas Index type | ||
Int64Index : Index of int64 data | ||
|
||
Methods | ||
------- | ||
from_range | ||
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. Is it because there is no Attributes section that you get those warnings? |
||
""" | ||
|
||
_typ = 'rangeindex' | ||
|
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.
Do you know why this is needed?