1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
U
¬ý°dëIã@s"UdZddlmZddddœdd„ZdZdZed    Zed
Zed Zed Z    ed Z
edZ edZ edZ edZedZedZedZedZedZdZdZdddeedœdddeedœd d!d"eed#d$œd%d&d'e edœd(d)d*e ed#d$œd+d,d-e    ed#d$œd.d/d0e
ed#d$œd1d2d3e ed#d$œd4d5d#eedœd6d7d#eedœd8d9d#eedœd:d;d#eedœd<d=d#eedœd>d?d#eedœd@œZdAedB<dCZee ¡ƒZeD]xZeedDZed#k    r”ee ¡ee<eeedD<dEeedF›dGe›eedH<dIeedF›dJe›eedH<q”dKZdLZ dMZ!dNZ"d#S)Oz
Templating for ops docstrings
é)Ú annotationsÚstr)Úop_nameÚtypÚreturnc    Cs| dd¡}t|}|d}|dk    s(t‚| d¡rDd|›d|›}n*|dkr^|›d    |›d
}n|›d|›d }|d krÒt}|d rœ|tj|d |dd7}|j|d|||dd}|d}|rÌ||}n|}n0|dkrút}|j|d|||d d}ntdƒ‚|S)at
    Make the appropriate substitutions for the given operation and class-typ
    into either _flex_doc_SERIES or _flex_doc_FRAME to return the docstring
    to attach to a generated method.
 
    Parameters
    ----------
    op_name : str {'__add__', '__sub__', ... '__eq__', '__ne__', ...}
    typ : str {series, 'dataframe']}
 
    Returns
    -------
    doc : str
    Ú__ÚÚopNÚrzother ú Údivmodú(z, other)z otherZseriesÚreverseÚ see_also_desc)rrÚdescÚseries_returns)rrÚequivrÚseries_examplesZ    dataframe)rrrrzInvalid typ argument.)ÚreplaceÚ_op_descriptionsÚAssertionErrorÚ
startswithÚ_flex_doc_SERIESÚ_see_also_reverse_SERIESÚformatÚ_flex_doc_FRAME)    rrZop_descZ
op_desc_oprZbase_docZdoc_no_examplesZ ser_exampleÚdoc©rúQd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/core/ops/docstrings.pyÚ make_flex_docsH  
ÿü
üra 
Examples
--------
>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
>>> a
a    1.0
b    1.0
c    1.0
d    NaN
dtype: float64
>>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
>>> b
a    1.0
b    NaN
d    1.0
e    NaN
dtype: float64a(
Examples
--------
>>> a = pd.Series([1, 1, 1, np.nan, 1], index=['a', 'b', 'c', 'd', 'e'])
>>> a
a    1.0
b    1.0
c    1.0
d    NaN
e    1.0
dtype: float64
>>> b = pd.Series([0, 1, 2, np.nan, 1], index=['a', 'b', 'c', 'd', 'f'])
>>> b
a    0.0
b    1.0
c    2.0
d    NaN
f    1.0
dtype: float64zX
>>> a.add(b, fill_value=0)
a    2.0
b    1.0
c    1.0
d    1.0
e    NaN
dtype: float64
z]
>>> a.subtract(b, fill_value=0)
a    0.0
b    1.0
c    1.0
d   -1.0
e    NaN
dtype: float64
z]
>>> a.multiply(b, fill_value=0)
a    1.0
b    0.0
c    0.0
d    0.0
e    NaN
dtype: float64
z[
>>> a.divide(b, fill_value=0)
a    1.0
b    inf
c    inf
d    0.0
e    NaN
dtype: float64
z]
>>> a.floordiv(b, fill_value=0)
a    1.0
b    inf
c    inf
d    0.0
e    NaN
dtype: float64
>>> a.divmod(b, fill_value=0)
(a    1.0
 b    NaN
 c    NaN
 d    0.0
 e    NaN
 dtype: float64,
 a    0.0
 b    NaN
 c    NaN
 d    0.0
 e    NaN
 dtype: float64)
zX
>>> a.mod(b, fill_value=0)
a    0.0
b    NaN
c    NaN
d    0.0
e    NaN
dtype: float64
zX
>>> a.pow(b, fill_value=0)
a    1.0
b    1.0
c    1.0
d    0.0
e    NaN
dtype: float64
z^
>>> a.ne(b, fill_value=0)
a    False
b     True
c     True
d     True
e     True
dtype: bool
z^
>>> a.eq(b, fill_value=0)
a     True
b    False
c    False
d    False
e    False
dtype: bool
zi
>>> a.lt(b, fill_value=0)
a    False
b    False
c     True
d    False
e    False
f     True
dtype: bool
zi
>>> a.le(b, fill_value=0)
a    False
b     True
c     True
d    False
e    False
f     True
dtype: bool
zi
>>> a.gt(b, fill_value=0)
a     True
b    False
c    False
d    False
e     True
f    False
dtype: bool
zi
>>> a.ge(b, fill_value=0)
a     True
b     True
c    False
d    False
e     True
f    False
dtype: bool
z'Series
    The result of the operation.z22-Tuple of Series
    The result of the operation.ú+ZAdditionZradd)r    rrrrú-Z SubtractionZrsubÚ*ZMultiplicationZrmulN)r    rrrrZ df_examplesú%ZModuloZrmodz**zExponential powerZrpowú/zFloating divisionZrtruedivz//zInteger divisionZ    rfloordivr zInteger division and moduloZrdivmodz==zEqual toz!=z Not equal toú<z    Less thanz<=zLess than or equal toú>z Greater thanz>=zGreater than or equal to)ÚaddÚsubÚmulÚmodÚpowÚtruedivÚfloordivr ÚeqÚneÚltÚleÚgtÚgez dict[str, dict[str, str | None]]rz…see
    `Python documentation
    <https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types>`_
    for more detailsrzReverse of the rz  operator, rz Element-wise z, a
Return {desc} of series and other, element-wise (binary operator `{op_name}`).
 
Equivalent to ``{equiv}``, but with support to substitute a fill_value for
missing data in either one of the inputs.
 
Parameters
----------
other : Series or scalar value
level : int or name
    Broadcast across a level, matching Index values on the
    passed MultiIndex level.
fill_value : None or float value, default None (NaN)
    Fill existing missing (NaN) values, and any new element needed for
    successful Series alignment, with this value before computation.
    If data in both corresponding Series locations is missing
    the result of filling (at that location) will be missing.
axis : {{0 or 'index'}}
    Unused. Parameter needed for compatibility with DataFrame.
 
Returns
-------
{series_returns}
z7
See Also
--------
Series.{reverse} : {see_also_desc}.
aË
Get {desc} of dataframe and other, element-wise (binary operator `{op_name}`).
 
Equivalent to ``{equiv}``, but with support to substitute a fill_value
for missing data in one of the inputs. With reverse version, `{reverse}`.
 
Among flexible wrappers (`add`, `sub`, `mul`, `div`, `mod`, `pow`) to
arithmetic operators: `+`, `-`, `*`, `/`, `//`, `%`, `**`.
 
Parameters
----------
other : scalar, sequence, Series, dict or DataFrame
    Any single or multiple element data structure, or list-like object.
axis : {{0 or 'index', 1 or 'columns'}}
    Whether to compare by the index (0 or 'index') or columns.
    (1 or 'columns'). For Series input, axis to match Series index on.
level : int or label
    Broadcast across a level, matching Index values on the
    passed MultiIndex level.
fill_value : float or None, default None
    Fill existing missing (NaN) values, and any new element needed for
    successful DataFrame alignment, with this value before computation.
    If data in both corresponding DataFrame locations is missing
    the result will be missing.
 
Returns
-------
DataFrame
    Result of the arithmetic operation.
 
See Also
--------
DataFrame.add : Add DataFrames.
DataFrame.sub : Subtract DataFrames.
DataFrame.mul : Multiply DataFrames.
DataFrame.div : Divide DataFrames (float division).
DataFrame.truediv : Divide DataFrames (float division).
DataFrame.floordiv : Divide DataFrames (integer division).
DataFrame.mod : Calculate modulo (remainder after division).
DataFrame.pow : Calculate exponential power.
 
Notes
-----
Mismatched indices will be unioned together.
 
Examples
--------
>>> df = pd.DataFrame({{'angles': [0, 3, 4],
...                    'degrees': [360, 180, 360]}},
...                   index=['circle', 'triangle', 'rectangle'])
>>> df
           angles  degrees
circle          0      360
triangle        3      180
rectangle       4      360
 
Add a scalar with operator version which return the same
results.
 
>>> df + 1
           angles  degrees
circle          1      361
triangle        4      181
rectangle       5      361
 
>>> df.add(1)
           angles  degrees
circle          1      361
triangle        4      181
rectangle       5      361
 
Divide by constant with reverse version.
 
>>> df.div(10)
           angles  degrees
circle        0.0     36.0
triangle      0.3     18.0
rectangle     0.4     36.0
 
>>> df.rdiv(10)
             angles   degrees
circle          inf  0.027778
triangle   3.333333  0.055556
rectangle  2.500000  0.027778
 
Subtract a list and Series by axis with operator version.
 
>>> df - [1, 2]
           angles  degrees
circle         -1      358
triangle        2      178
rectangle       3      358
 
>>> df.sub([1, 2], axis='columns')
           angles  degrees
circle         -1      358
triangle        2      178
rectangle       3      358
 
>>> df.sub(pd.Series([1, 1, 1], index=['circle', 'triangle', 'rectangle']),
...        axis='index')
           angles  degrees
circle         -1      359
triangle        2      179
rectangle       3      359
 
Multiply a dictionary by axis.
 
>>> df.mul({{'angles': 0, 'degrees': 2}})
            angles  degrees
circle           0      720
triangle         0      360
rectangle        0      720
 
>>> df.mul({{'circle': 0, 'triangle': 2, 'rectangle': 3}}, axis='index')
            angles  degrees
circle           0        0
triangle         6      360
rectangle       12     1080
 
Multiply a DataFrame of different shape with operator version.
 
>>> other = pd.DataFrame({{'angles': [0, 3, 4]}},
...                      index=['circle', 'triangle', 'rectangle'])
>>> other
           angles
circle          0
triangle        3
rectangle       4
 
>>> df * other
           angles  degrees
circle          0      NaN
triangle        9      NaN
rectangle      16      NaN
 
>>> df.mul(other, fill_value=0)
           angles  degrees
circle          0      0.0
triangle        9      0.0
rectangle      16      0.0
 
Divide by a MultiIndex by level.
 
>>> df_multindex = pd.DataFrame({{'angles': [0, 3, 4, 4, 5, 6],
...                              'degrees': [360, 180, 360, 360, 540, 720]}},
...                             index=[['A', 'A', 'A', 'B', 'B', 'B'],
...                                    ['circle', 'triangle', 'rectangle',
...                                     'square', 'pentagon', 'hexagon']])
>>> df_multindex
             angles  degrees
A circle          0      360
  triangle        3      180
  rectangle       4      360
B square          4      360
  pentagon        5      540
  hexagon         6      720
 
>>> df.div(df_multindex, level=1, fill_value=0)
             angles  degrees
A circle        NaN      1.0
  triangle      1.0      1.0
  rectangle     1.0      1.0
B square        0.0      0.0
  pentagon      0.0      0.0
  hexagon       0.0      0.0
a<
Get {desc} of dataframe and other, element-wise (binary operator `{op_name}`).
 
Among flexible wrappers (`eq`, `ne`, `le`, `lt`, `ge`, `gt`) to comparison
operators.
 
Equivalent to `==`, `!=`, `<=`, `<`, `>=`, `>` with support to choose axis
(rows or columns) and level for comparison.
 
Parameters
----------
other : scalar, sequence, Series, or DataFrame
    Any single or multiple element data structure, or list-like object.
axis : {{0 or 'index', 1 or 'columns'}}, default 'columns'
    Whether to compare by the index (0 or 'index') or columns
    (1 or 'columns').
level : int or label
    Broadcast across a level, matching Index values on the passed
    MultiIndex level.
 
Returns
-------
DataFrame of bool
    Result of the comparison.
 
See Also
--------
DataFrame.eq : Compare DataFrames for equality elementwise.
DataFrame.ne : Compare DataFrames for inequality elementwise.
DataFrame.le : Compare DataFrames for less than inequality
    or equality elementwise.
DataFrame.lt : Compare DataFrames for strictly less than
    inequality elementwise.
DataFrame.ge : Compare DataFrames for greater than inequality
    or equality elementwise.
DataFrame.gt : Compare DataFrames for strictly greater than
    inequality elementwise.
 
Notes
-----
Mismatched indices will be unioned together.
`NaN` values are considered different (i.e. `NaN` != `NaN`).
 
Examples
--------
>>> df = pd.DataFrame({{'cost': [250, 150, 100],
...                    'revenue': [100, 250, 300]}},
...                   index=['A', 'B', 'C'])
>>> df
   cost  revenue
A   250      100
B   150      250
C   100      300
 
Comparison with a scalar, using either the operator or method:
 
>>> df == 100
    cost  revenue
A  False     True
B  False    False
C   True    False
 
>>> df.eq(100)
    cost  revenue
A  False     True
B  False    False
C   True    False
 
When `other` is a :class:`Series`, the columns of a DataFrame are aligned
with the index of `other` and broadcast:
 
>>> df != pd.Series([100, 250], index=["cost", "revenue"])
    cost  revenue
A   True     True
B   True    False
C  False     True
 
Use the method to control the broadcast axis:
 
>>> df.ne(pd.Series([100, 300], index=["A", "D"]), axis='index')
   cost  revenue
A  True    False
B  True     True
C  True     True
D  True     True
 
When comparing to an arbitrary sequence, the number of columns must
match the number elements in `other`:
 
>>> df == [250, 100]
    cost  revenue
A   True     True
B  False    False
C  False    False
 
Use the method to control the axis:
 
>>> df.eq([250, 250, 100], axis='index')
    cost  revenue
A   True    False
B  False     True
C   True    False
 
Compare to a DataFrame of different shape.
 
>>> other = pd.DataFrame({{'revenue': [300, 250, 100, 150]}},
...                      index=['A', 'B', 'C', 'D'])
>>> other
   revenue
A      300
B      250
C      100
D      150
 
>>> df.gt(other)
    cost  revenue
A  False    False
B  False    False
C  False     True
D  False    False
 
Compare to a MultiIndex by level.
 
>>> df_multindex = pd.DataFrame({{'cost': [250, 150, 100, 150, 300, 220],
...                              'revenue': [100, 250, 300, 200, 175, 225]}},
...                             index=[['Q1', 'Q1', 'Q1', 'Q2', 'Q2', 'Q2'],
...                                    ['A', 'B', 'C', 'A', 'B', 'C']])
>>> df_multindex
      cost  revenue
Q1 A   250      100
   B   150      250
   C   100      300
Q2 A   150      200
   B   300      175
   C   220      225
 
>>> df.le(df_multindex, level=1)
       cost  revenue
Q1 A   True     True
   B   True     True
   C   True     True
Q2 A  False     True
   B   True    False
   C   True    False
)#Ú__doc__Ú
__future__rrZ_common_examples_algebra_SERIESZ"_common_examples_comparison_SERIESZ_add_example_SERIESZ_sub_example_SERIESZ_mul_example_SERIESZ_div_example_SERIESZ_floordiv_example_SERIESZ_divmod_example_SERIESZ_mod_example_SERIESZ_pow_example_SERIESZ_ne_example_SERIESZ_eq_example_SERIESZ_lt_example_SERIESZ_le_example_SERIESZ_gt_example_SERIESZ_ge_example_SERIESZ_returns_seriesZ_returns_tuplerÚ__annotations__Z _py_num_refÚlistÚkeysZ    _op_namesÚkeyZ
reverse_opÚcopyrrrZ_flex_comp_doc_FRAMErrrrÚ<module>sX 9ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿûûú    ûú    ú    ú    ú
ûûûûûûl  
 þÿþÿ)