Skip to content

Commit 61e93e5

Browse files
committed
Some doc string changes
1 parent a74db3f commit 61e93e5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pandas/core/indexes/range.py

+7
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,13 @@ def _constructor(self):
188188

189189
@property
190190
def _data(self):
191+
"""
192+
An int array that for performance reasons is created only when needed.
193+
194+
The constructed array is saved in ``_cached_data``. This allows us to
195+
check if the array has been created without accessing ``_data`` and
196+
triggering the construction.
197+
"""
191198
if self._cached_data is None:
192199
self._cached_data = np.arange(self._start, self._stop, self._step,
193200
dtype=np.int64)

pandas/tests/indexes/test_range.py

+1
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ def test_dtype(self):
242242
assert self.index.dtype == np.int64
243243

244244
def test_cached_data(self):
245+
# GH 26565
245246
# Calling RangeIndex._data caches an int64 array of the same length at
246247
# self._cached_data. This tests whether _cached_data has been set.
247248
idx = RangeIndex(0, 100, 10)

0 commit comments

Comments
 (0)