-
- Notifications
You must be signed in to change notification settings - Fork 19.3k
DOC: document subclasses in API docs with selection of specific methods/attributes #18202
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 2 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -653,6 +653,12 @@ The dtype of a ``Categorical`` can be described by a :class:`pandas.api.types.Ca | |
| | ||
| api.types.CategoricalDtype | ||
| | ||
| .. autosummary:: | ||
| :toctree: generated/ | ||
| | ||
| api.types.CategoricalDtype.categories | ||
| api.types.CategoricalDtype.ordered | ||
| | ||
| If the Series is of dtype ``CategoricalDtype``, ``Series.cat`` can be used to change the categorical | ||
| data. This accessor is similar to the ``Series.dt`` or ``Series.str`` and has the | ||
| following usable methods and properties: | ||
| | @@ -692,6 +698,10 @@ adding ordering information or special categories is need at creation time of th | |
| .. autosummary:: | ||
| :toctree: generated/ | ||
| | ||
| Categorical.categories | ||
| Categorical.ordered | ||
| Categorical.codes | ||
| Categorical.dtype | ||
| Categorical.from_codes | ||
| | ||
| ``np.asarray(categorical)`` works by implementing the array interface. Be aware, that this converts | ||
| | @@ -792,11 +802,14 @@ Attributes and underlying data | |
| DataFrame.get_ftype_counts | ||
| DataFrame.select_dtypes | ||
| DataFrame.values | ||
| DataFrame.get_values | ||
| DataFrame.axes | ||
| DataFrame.ndim | ||
| DataFrame.size | ||
| DataFrame.shape | ||
| DataFrame.memory_usage | ||
| DataFrame.empty | ||
| DataFrame.is_copy | ||
| | ||
| Conversion | ||
| ~~~~~~~~~~ | ||
| | @@ -809,6 +822,7 @@ Conversion | |
| DataFrame.copy | ||
| DataFrame.isna | ||
| DataFrame.notna | ||
| DataFrame.bool | ||
| | ||
| Indexing, iteration | ||
| ~~~~~~~~~~~~~~~~~~~ | ||
| | @@ -821,14 +835,18 @@ Indexing, iteration | |
| DataFrame.loc | ||
| DataFrame.iloc | ||
| DataFrame.insert | ||
| DataFrame.insert | ||
| DataFrame.__iter__ | ||
| DataFrame.items | ||
| DataFrame.keys | ||
| DataFrame.iteritems | ||
| DataFrame.iterrows | ||
| DataFrame.itertuples | ||
| DataFrame.lookup | ||
| DataFrame.pop | ||
| DataFrame.tail | ||
| DataFrame.xs | ||
| DataFrame.get | ||
| DataFrame.isin | ||
| DataFrame.where | ||
| DataFrame.mask | ||
| | @@ -845,12 +863,16 @@ Binary operator functions | |
| | ||
| DataFrame.add | ||
| DataFrame.sub | ||
| DataFrame.subtract | ||
| ||
| DataFrame.mul | ||
| DataFrame.multiply | ||
| DataFrame.div | ||
| DataFrame.divide | ||
| DataFrame.truediv | ||
| DataFrame.floordiv | ||
| DataFrame.mod | ||
| DataFrame.pow | ||
| DataFrame.dot | ||
| DataFrame.radd | ||
| DataFrame.rsub | ||
| DataFrame.rmul | ||
| | @@ -875,6 +897,8 @@ Function application, GroupBy & Window | |
| | ||
| DataFrame.apply | ||
| DataFrame.applymap | ||
| DataFrame.pipe | ||
| DataFrame.agg | ||
| DataFrame.aggregate | ||
| DataFrame.transform | ||
| DataFrame.groupby | ||
| | @@ -895,6 +919,7 @@ Computations / Descriptive Stats | |
| DataFrame.clip | ||
| DataFrame.clip_lower | ||
| DataFrame.clip_upper | ||
| DataFrame.compound | ||
| DataFrame.corr | ||
| DataFrame.corrwith | ||
| DataFrame.count | ||
| | @@ -907,6 +932,7 @@ Computations / Descriptive Stats | |
| DataFrame.diff | ||
| DataFrame.eval | ||
| DataFrame.kurt | ||
| DataFrame.kurtosis | ||
| DataFrame.mad | ||
| DataFrame.max | ||
| DataFrame.mean | ||
| | @@ -915,6 +941,7 @@ Computations / Descriptive Stats | |
| DataFrame.mode | ||
| DataFrame.pct_change | ||
| DataFrame.prod | ||
| DataFrame.product | ||
| DataFrame.quantile | ||
| DataFrame.rank | ||
| DataFrame.round | ||
| | @@ -923,6 +950,7 @@ Computations / Descriptive Stats | |
| DataFrame.sum | ||
| DataFrame.std | ||
| DataFrame.var | ||
| DataFrame.nunique | ||
| | ||
| Reindexing / Selection / Label manipulation | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| | @@ -932,6 +960,8 @@ Reindexing / Selection / Label manipulation | |
| DataFrame.add_prefix | ||
| DataFrame.add_suffix | ||
| DataFrame.align | ||
| DataFrame.at_time | ||
| DataFrame.between_time | ||
| DataFrame.drop | ||
| DataFrame.drop_duplicates | ||
| DataFrame.duplicated | ||
| | @@ -950,6 +980,7 @@ Reindexing / Selection / Label manipulation | |
| DataFrame.reset_index | ||
| DataFrame.sample | ||
| DataFrame.select | ||
| DataFrame.set_axis | ||
| DataFrame.set_index | ||
| DataFrame.tail | ||
| DataFrame.take | ||
| | @@ -965,13 +996,17 @@ Missing data handling | |
| DataFrame.dropna | ||
| DataFrame.fillna | ||
| DataFrame.replace | ||
| DataFrame.interpolate | ||
| DataFrame.isnull | ||
| DataFrame.notnull | ||
| ||
| | ||
| Reshaping, sorting, transposing | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| .. autosummary:: | ||
| :toctree: generated/ | ||
| | ||
| DataFrame.pivot | ||
| DataFrame.pivot_table | ||
| DataFrame.reorder_levels | ||
| DataFrame.sort_values | ||
| DataFrame.sort_index | ||
| | @@ -980,10 +1015,12 @@ Reshaping, sorting, transposing | |
| DataFrame.swaplevel | ||
| DataFrame.stack | ||
| DataFrame.unstack | ||
| DataFrame.swapaxes | ||
| DataFrame.melt | ||
| DataFrame.T | ||
| DataFrame.squeeze | ||
| DataFrame.to_panel | ||
| DataFrame.to_xarray | ||
| DataFrame.T | ||
| DataFrame.transpose | ||
| | ||
| Combining / joining / merging | ||
| | @@ -1005,6 +1042,8 @@ Time series-related | |
| DataFrame.asfreq | ||
| DataFrame.asof | ||
| DataFrame.shift | ||
| DataFrame.slice_shift | ||
| DataFrame.tshift | ||
| DataFrame.first_valid_index | ||
| DataFrame.last_valid_index | ||
| DataFrame.resample | ||
| | @@ -1059,6 +1098,7 @@ Serialization / IO / Conversion | |
| DataFrame.from_items | ||
| DataFrame.from_records | ||
| DataFrame.info | ||
| DataFrame.to_parquet | ||
| DataFrame.to_pickle | ||
| DataFrame.to_csv | ||
| DataFrame.to_hdf | ||
| | @@ -1077,6 +1117,7 @@ Serialization / IO / Conversion | |
| DataFrame.to_dense | ||
| DataFrame.to_string | ||
| DataFrame.to_clipboard | ||
| DataFrame.style | ||
| | ||
| Sparse | ||
| ~~~~~~ | ||
| | @@ -1438,6 +1479,15 @@ Numeric Index | |
| UInt64Index | ||
| Float64Index | ||
| | ||
| .. We need this autosummary so that the methods are generated. | ||
| .. Separate block, since they aren't classes. | ||
| | ||
| .. autosummary:: | ||
| :toctree: generated/ | ||
| | ||
| RangeIndex.from_range | ||
| | ||
| | ||
| .. _api.categoricalindex: | ||
| | ||
| CategoricalIndex | ||
| | @@ -1466,6 +1516,8 @@ Categorical Components | |
| CategoricalIndex.set_categories | ||
| CategoricalIndex.as_ordered | ||
| CategoricalIndex.as_unordered | ||
| CategoricalIndex.get_loc | ||
| CategoricalIndex.map | ||
| 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. Are those needed to include ? (I mean, do they have something categorical specific ?) | ||
| | ||
| .. _api.intervalindex: | ||
| | ||
| | @@ -1488,6 +1540,15 @@ IntervalIndex Components | |
| IntervalIndex.from_tuples | ||
| IntervalIndex.from_breaks | ||
| IntervalIndex.from_intervals | ||
| IntervalIndex.contains | ||
| IntervalIndex.get_loc | ||
| IntervalIndex.left | ||
| IntervalIndex.right | ||
| IntervalIndex.mid | ||
| IntervalIndex.closed | ||
| IntervalIndex.values | ||
| IntervalIndex.is_non_overlapping_monotonic | ||
| | ||
| | ||
| .. _api.multiindex: | ||
| | ||
| | @@ -2284,3 +2345,26 @@ Scalar introspection | |
| api.types.is_re | ||
| api.types.is_re_compilable | ||
| api.types.is_scalar | ||
| | ||
| | ||
| .. This is to prevent warnings in the doc build. We don't want to encourage | ||
| .. these methods. | ||
| | ||
| .. toctree:: | ||
| :hidden: | ||
| | ||
| generated/pandas.DataFrame.as_blocks | ||
| generated/pandas.DataFrame.ffill | ||
| generated/pandas.DataFrame.bfill | ||
| generated/pandas.DataFrame.blocks | ||
| generated/pandas.DataFrame.sortlevel | ||
| generated/pandas.DataFrame.consolidate | ||
| generated/pandas.DataFrame.set_value | ||
| generated/pandas.DataFrame.get_value | ||
| | ||
| generated/pandas.Series.as_blocks | ||
| generated/pandas.Series.ffill | ||
| generated/pandas.Series.bfill | ||
| generated/pandas.Series.set_value | ||
| generated/pandas.Series.get_value | ||
| generated/pandas.Series.blocks | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -68,6 +68,7 @@ | |
| ] | ||
| | ||
| exclude_patterns = ['**.ipynb_checkpoints'] | ||
| numpydoc_show_class_members = False | ||
| ||
| | ||
| with open("index.rst") as f: | ||
| index_rst_lines = f.readlines() | ||
| | ||
| 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 | ||
| ||
| map | ||
| | ||
| Attributes | ||
| ||
| ---------- | ||
| codes | ||
| categories | ||
| ordered | ||
| ||
| """ | ||
| | ||
| _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.
I know that this is the wrong place for this (doesn't fit w/ the text above). I'm going to make a dedicated section for
Categorical.