57
57
58
58
_interval_shared_docs = {}
59
59
60
- _shared_docs_kwargs = dict (
61
- klass = "IntervalArray" , qualname = "arrays.IntervalArray" , name = ""
62
- )
60
+ _shared_docs_kwargs = {
61
+ "klass" : "IntervalArray" ,
62
+ "qualname" : "arrays.IntervalArray" ,
63
+ "name" : "" ,
64
+ }
63
65
64
66
65
67
_interval_shared_docs [
127
129
128
130
@Appender (
129
131
_interval_shared_docs ["class" ]
130
- % dict (
131
- klass = "IntervalArray" ,
132
- summary = "Pandas array for interval data that are closed on the same side." ,
133
- versionadded = "0.24.0" ,
134
- name = "" ,
135
- extra_attributes = "" ,
136
- extra_methods = "" ,
137
- examples = textwrap .dedent (
132
+ % {
133
+ " klass" : "IntervalArray" ,
134
+ " summary" : "Pandas array for interval data that are closed on the same side." ,
135
+ " versionadded" : "0.24.0" ,
136
+ " name" : "" ,
137
+ " extra_attributes" : "" ,
138
+ " extra_methods" : "" ,
139
+ " examples" : textwrap .dedent (
138
140
"""\
139
141
Examples
140
142
--------
151
153
:meth:`IntervalArray.from_breaks`, and :meth:`IntervalArray.from_tuples`.
152
154
"""
153
155
),
154
- )
156
+ }
155
157
)
156
158
class IntervalArray (IntervalMixin , ExtensionArray ):
157
159
ndim = 1
@@ -319,9 +321,9 @@ def _from_factorized(cls, values, original):
319
321
@classmethod
320
322
@Appender (
321
323
_interval_shared_docs ["from_breaks" ]
322
- % dict (
323
- klass = "IntervalArray" ,
324
- examples = textwrap .dedent (
324
+ % {
325
+ " klass" : "IntervalArray" ,
326
+ " examples" : textwrap .dedent (
325
327
"""\
326
328
Examples
327
329
--------
@@ -331,7 +333,7 @@ def _from_factorized(cls, values, original):
331
333
Length: 3, closed: right, dtype: interval[int64]
332
334
"""
333
335
),
334
- )
336
+ }
335
337
)
336
338
def from_breaks (cls , breaks , closed = "right" , copy = False , dtype = None ):
337
339
breaks = maybe_convert_platform_interval (breaks )
@@ -390,17 +392,17 @@ def from_breaks(cls, breaks, closed="right", copy=False, dtype=None):
390
392
@classmethod
391
393
@Appender (
392
394
_interval_shared_docs ["from_arrays" ]
393
- % dict (
394
- klass = "IntervalArray" ,
395
- examples = textwrap .dedent (
395
+ % {
396
+ " klass" : "IntervalArray" ,
397
+ " examples" : textwrap .dedent (
396
398
"""\
397
399
>>> pd.arrays.IntervalArray.from_arrays([0, 1, 2], [1, 2, 3])
398
400
<IntervalArray>
399
401
[(0, 1], (1, 2], (2, 3]]
400
402
Length: 3, closed: right, dtype: interval[int64]
401
403
"""
402
404
),
403
- )
405
+ }
404
406
)
405
407
def from_arrays (cls , left , right , closed = "right" , copy = False , dtype = None ):
406
408
left = maybe_convert_platform_interval (left )
@@ -445,9 +447,9 @@ def from_arrays(cls, left, right, closed="right", copy=False, dtype=None):
445
447
@classmethod
446
448
@Appender (
447
449
_interval_shared_docs ["from_tuples" ]
448
- % dict (
449
- klass = "IntervalArray" ,
450
- examples = textwrap .dedent (
450
+ % {
451
+ " klass" : "IntervalArray" ,
452
+ " examples" : textwrap .dedent (
451
453
"""\
452
454
Examples
453
455
--------
@@ -457,7 +459,7 @@ def from_arrays(cls, left, right, closed="right", copy=False, dtype=None):
457
459
Length: 2, closed: right, dtype: interval[int64]
458
460
"""
459
461
),
460
- )
462
+ }
461
463
)
462
464
def from_tuples (cls , data , closed = "right" , copy = False , dtype = None ):
463
465
if len (data ):
@@ -904,7 +906,7 @@ def take(self, indices, *, allow_fill=False, fill_value=None, axis=None, **kwarg
904
906
When `indices` contains negative values other than ``-1``
905
907
and `allow_fill` is True.
906
908
"""
907
- nv .validate_take (tuple (), kwargs )
909
+ nv .validate_take ((), kwargs )
908
910
909
911
fill_left = fill_right = fill_value
910
912
if allow_fill :
@@ -1144,9 +1146,9 @@ def mid(self):
1144
1146
1145
1147
@Appender (
1146
1148
_interval_shared_docs ["overlaps" ]
1147
- % dict (
1148
- klass = "IntervalArray" ,
1149
- examples = textwrap .dedent (
1149
+ % {
1150
+ " klass" : "IntervalArray" ,
1151
+ " examples" : textwrap .dedent (
1150
1152
"""\
1151
1153
>>> data = [(0, 1), (1, 3), (2, 4)]
1152
1154
>>> intervals = pd.arrays.IntervalArray.from_tuples(data)
@@ -1156,7 +1158,7 @@ def mid(self):
1156
1158
Length: 3, closed: right, dtype: interval[int64]
1157
1159
"""
1158
1160
),
1159
- )
1161
+ }
1160
1162
)
1161
1163
def overlaps (self , other ):
1162
1164
if isinstance (other , (IntervalArray , ABCIntervalIndex )):
@@ -1207,9 +1209,9 @@ def closed(self):
1207
1209
1208
1210
@Appender (
1209
1211
_interval_shared_docs ["set_closed" ]
1210
- % dict (
1211
- klass = "IntervalArray" ,
1212
- examples = textwrap .dedent (
1212
+ % {
1213
+ " klass" : "IntervalArray" ,
1214
+ " examples" : textwrap .dedent (
1213
1215
"""\
1214
1216
Examples
1215
1217
--------
@@ -1224,7 +1226,7 @@ def closed(self):
1224
1226
Length: 3, closed: both, dtype: interval[int64]
1225
1227
"""
1226
1228
),
1227
- )
1229
+ }
1228
1230
)
1229
1231
def set_closed (self , closed ):
1230
1232
if closed not in VALID_CLOSED :
@@ -1360,7 +1362,7 @@ def __arrow_array__(self, type=None):
1360
1362
"""
1361
1363
1362
1364
@Appender (
1363
- _interval_shared_docs ["to_tuples" ] % dict ( return_type = " ndarray" , examples = "" )
1365
+ _interval_shared_docs ["to_tuples" ] % { " return_type" : " ndarray" , " examples" : "" }
1364
1366
)
1365
1367
def to_tuples (self , na_tuple = True ):
1366
1368
tuples = com .asarray_tuplesafe (zip (self ._left , self ._right ))
@@ -1373,7 +1375,7 @@ def to_tuples(self, na_tuple=True):
1373
1375
1374
1376
@Appender (_extension_array_shared_docs ["repeat" ] % _shared_docs_kwargs )
1375
1377
def repeat (self , repeats , axis = None ):
1376
- nv .validate_repeat (tuple (), dict ( axis = axis ) )
1378
+ nv .validate_repeat ((), { " axis" : axis } )
1377
1379
left_repeat = self .left .repeat (repeats )
1378
1380
right_repeat = self .right .repeat (repeats )
1379
1381
return self ._shallow_copy (left = left_repeat , right = right_repeat )
@@ -1412,9 +1414,9 @@ def repeat(self, repeats, axis=None):
1412
1414
1413
1415
@Appender (
1414
1416
_interval_shared_docs ["contains" ]
1415
- % dict (
1416
- klass = "IntervalArray" ,
1417
- examples = textwrap .dedent (
1417
+ % {
1418
+ " klass" : "IntervalArray" ,
1419
+ " examples" : textwrap .dedent (
1418
1420
"""\
1419
1421
>>> intervals = pd.arrays.IntervalArray.from_tuples([(0, 1), (1, 3), (2, 4)])
1420
1422
>>> intervals
@@ -1423,7 +1425,7 @@ def repeat(self, repeats, axis=None):
1423
1425
Length: 3, closed: right, dtype: interval[int64]
1424
1426
"""
1425
1427
),
1426
- )
1428
+ }
1427
1429
)
1428
1430
def contains (self , other ):
1429
1431
if isinstance (other , Interval ):
0 commit comments