Skip to content

Commit 4a0f354

Browse files
author
tp
committed
Add references for different index types + examples for pd.Index
1 parent 45a795e commit 4a0f354

File tree

8 files changed

+55
-2
lines changed

8 files changed

+55
-2
lines changed

pandas/core/indexes/base.py

+23
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,29 @@ class Index(IndexOpsMixin, PandasObject):
122122
Notes
123123
-----
124124
An Index instance can **only** contain hashable objects
125+
126+
Examples
127+
--------
128+
>>> pd.Index([1, 2, 3])
129+
Int64Index([1, 2, 3], dtype='int64')
130+
131+
>>> pd.Index(list('abc'))
132+
Index(['a', 'b', 'c'], dtype='object')
133+
134+
See Also
135+
---------
136+
RangeIndex : Index implementing a monotonic integer range (very
137+
memory-efficient)
138+
CategoricalIndex : Index with :class:`Categorical` s.
139+
MultiIndex : A multi-level, or hierarchical, Index
140+
DatetimeIndex : Index with datetime64 data
141+
TimedeltaIndex : Index of timedelta64 data
142+
PeriodIndex : Index holding regular time periods such as years, quarters,
143+
months, etc.
144+
IntervalIndex : an Index of :class:`Interval` s.
145+
Int64Index : Index with int64 data
146+
UInt64Index : Index with uint64 data
147+
Float64Index : Index with float64 data
125148
"""
126149
# To hand over control to subclasses
127150
_join_precedence = 1

pandas/core/indexes/datetimes.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,15 @@ class DatetimeIndex(DatelikeOps, TimelikeOps, DatetimeIndexOpsMixin,
206206
207207
Notes
208208
-----
209-
210209
To learn more about the frequency strings, please see `this link
211210
<http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases>`__.
211+
212+
See Also
213+
---------
214+
Index : The base pandas Index type
215+
TimedeltaIndex : Index of timedelta64 data
216+
PeriodIndex : Index holding regular time periods such as years, quarters,
217+
months, etc.
212218
"""
213219

214220
_typ = 'datetimeindex'

pandas/core/indexes/interval.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class IntervalIndex(IntervalMixin, Index):
122122
123123
See Also
124124
--------
125-
Index
125+
Index : The base pandas Index type
126126
"""
127127
_typ = 'intervalindex'
128128
_comparables = ['name']

pandas/core/indexes/multi.py

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class MultiIndex(Index):
9595
MultiIndex.from_product : Create a MultiIndex from the cartesian product
9696
of iterables
9797
MultiIndex.from_tuples : Convert list of tuples to a MultiIndex
98+
Index : The base pandas Index type
9899
"""
99100

100101
# initialize to zero-length tuples to make everything work

pandas/core/indexes/numeric.py

+5
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,14 @@ def is_all_dates(self):
108108
Make a copy of input ndarray
109109
name : object
110110
Name to be stored in the index
111+
111112
Notes
112113
-----
113114
An Index instance can **only** contain hashable objects.
115+
116+
See also
117+
--------
118+
Index : The base pandas Index type
114119
"""
115120

116121
_int64_descr_args = dict(

pandas/core/indexes/period.py

+6
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ class PeriodIndex(DatelikeOps, DatetimeIndexOpsMixin, Int64Index):
163163
>>> idx = PeriodIndex(year=year_arr, quarter=q_arr)
164164
165165
>>> idx2 = PeriodIndex(start='2000', end='2010', freq='A')
166+
167+
See Also
168+
---------
169+
Index : The base pandas Index type
170+
DatetimeIndex : Index with datetime64 data
171+
TimedeltaIndex : Index of timedelta64 data
166172
"""
167173
_box_scalars = True
168174
_typ = 'periodindex'

pandas/core/indexes/range.py

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ class RangeIndex(Int64Index):
3838
copy : bool, default False
3939
Unused, accepted for homogeneity with other index types.
4040
41+
See Also
42+
--------
43+
Index : The base pandas Index type
44+
Int64Index : Index with int64 data
4145
"""
4246

4347
_typ = 'rangeindex'

pandas/core/indexes/timedeltas.py

+8
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ class TimedeltaIndex(DatetimeIndexOpsMixin, TimelikeOps, Int64Index):
114114
115115
To learn more about the frequency strings, please see `this link
116116
<http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases>`__.
117+
118+
See Also
119+
---------
120+
Index : The base pandas Index type
121+
TimeDelta : Represents a duration between two dates or times.
122+
DatetimeIndex : Index with datetime64 data
123+
PeriodIndex : Index holding regular time periods such as years, quarters,
124+
months, etc.
117125
"""
118126

119127
_typ = 'timedeltaindex'

0 commit comments

Comments
 (0)