File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1
1
from datetime import timedelta
2
2
import operator
3
3
from sys import getsizeof
4
- from typing import Any
4
+ from typing import Any , List
5
5
import warnings
6
6
7
7
import numpy as np
@@ -187,6 +187,11 @@ def _format_data(self, name=None):
187
187
# we are formatting thru the attributes
188
188
return None
189
189
190
+ def _format_with_header (self , header , na_rep = "NaN" ) -> List [str ]:
191
+ start_str , stop_str = str (self ._range .start ), str (self ._range .stop )
192
+ max_length = max (len (start_str ), len (stop_str ))
193
+ return header + [f"{ x :<{max_length }} " for x in self ._range ]
194
+
190
195
# --------------------------------------------------------------------
191
196
_deprecation_message = (
192
197
"RangeIndex.{} is deprecated and will be "
Original file line number Diff line number Diff line change @@ -171,8 +171,14 @@ def test_cache(self):
171
171
pass
172
172
assert idx ._cache == {}
173
173
174
+ idx .format ()
175
+ assert idx ._cache == {}
176
+
174
177
df = pd .DataFrame ({"a" : range (10 )}, index = idx )
175
178
179
+ str (df )
180
+ assert idx ._cache == {}
181
+
176
182
df .loc [50 ]
177
183
assert idx ._cache == {}
178
184
You can’t perform that action at this time.
0 commit comments