@@ -53,7 +53,7 @@ def _make_flex_doc(op_name, typ):
53
53
return doc
54
54
55
55
56
- _add_example_SERIES = """
56
+ _common_examples_SERIES = """
57
57
Examples
58
58
--------
59
59
>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
@@ -69,33 +69,39 @@ def _make_flex_doc(op_name, typ):
69
69
b NaN
70
70
d 1.0
71
71
e NaN
72
- dtype: float64
73
- >>> a.add(b, fill_value=0)
74
- a 2.0
75
- b 1.0
76
- c 1.0
77
- d 1.0
78
- e NaN
79
- dtype: float64
80
- """
72
+ dtype: float64"""
81
73
82
- _sub_example_SERIES = """
74
+ _common_examples_comparison_SERIES = """
83
75
Examples
84
76
--------
85
- >>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
77
+ >>> a = pd.Series([1, 1, 1, np.nan, 1 ], index=['a', 'b', 'c', 'd', 'e '])
86
78
>>> a
87
79
a 1.0
88
80
b 1.0
89
81
c 1.0
90
82
d NaN
83
+ e 1.0
91
84
dtype: float64
92
- >>> b = pd.Series([1, np.nan, 1 , np.nan], index=['a', 'b', 'd', 'e '])
85
+ >>> b = pd.Series([0, 1, 2 , np.nan, 1 ], index=['a', 'b', 'c', ' d', 'f '])
93
86
>>> b
94
- a 1.0
95
- b NaN
87
+ a 0.0
88
+ b 1.0
89
+ c 2.0
90
+ d NaN
91
+ f 1.0
92
+ dtype: float64"""
93
+
94
+ _add_example_SERIES = _common_examples_SERIES + """
95
+ >>> a.add(b, fill_value=0)
96
+ a 2.0
97
+ b 1.0
98
+ c 1.0
96
99
d 1.0
97
100
e NaN
98
101
dtype: float64
102
+ """
103
+
104
+ _sub_example_SERIES = _common_examples_SERIES + """
99
105
>>> a.subtract(b, fill_value=0)
100
106
a 0.0
101
107
b 1.0
@@ -105,23 +111,7 @@ def _make_flex_doc(op_name, typ):
105
111
dtype: float64
106
112
"""
107
113
108
- _mul_example_SERIES = """
109
- Examples
110
- --------
111
- >>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
112
- >>> a
113
- a 1.0
114
- b 1.0
115
- c 1.0
116
- d NaN
117
- dtype: float64
118
- >>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
119
- >>> b
120
- a 1.0
121
- b NaN
122
- d 1.0
123
- e NaN
124
- dtype: float64
114
+ _mul_example_SERIES = _common_examples_SERIES + """
125
115
>>> a.multiply(b, fill_value=0)
126
116
a 1.0
127
117
b 0.0
@@ -131,23 +121,7 @@ def _make_flex_doc(op_name, typ):
131
121
dtype: float64
132
122
"""
133
123
134
- _div_example_SERIES = """
135
- Examples
136
- --------
137
- >>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
138
- >>> a
139
- a 1.0
140
- b 1.0
141
- c 1.0
142
- d NaN
143
- dtype: float64
144
- >>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
145
- >>> b
146
- a 1.0
147
- b NaN
148
- d 1.0
149
- e NaN
150
- dtype: float64
124
+ _div_example_SERIES = _common_examples_SERIES + """
151
125
>>> a.divide(b, fill_value=0)
152
126
a 1.0
153
127
b inf
@@ -157,23 +131,7 @@ def _make_flex_doc(op_name, typ):
157
131
dtype: float64
158
132
"""
159
133
160
- _floordiv_example_SERIES = """
161
- Examples
162
- --------
163
- >>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
164
- >>> a
165
- a 1.0
166
- b 1.0
167
- c 1.0
168
- d NaN
169
- dtype: float64
170
- >>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
171
- >>> b
172
- a 1.0
173
- b NaN
174
- d 1.0
175
- e NaN
176
- dtype: float64
134
+ _floordiv_example_SERIES = _common_examples_SERIES + """
177
135
>>> a.floordiv(b, fill_value=0)
178
136
a 1.0
179
137
b NaN
@@ -183,23 +141,7 @@ def _make_flex_doc(op_name, typ):
183
141
dtype: float64
184
142
"""
185
143
186
- _mod_example_SERIES = """
187
- Examples
188
- --------
189
- >>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
190
- >>> a
191
- a 1.0
192
- b 1.0
193
- c 1.0
194
- d NaN
195
- dtype: float64
196
- >>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
197
- >>> b
198
- a 1.0
199
- b NaN
200
- d 1.0
201
- e NaN
202
- dtype: float64
144
+ _mod_example_SERIES = _common_examples_SERIES + """
203
145
>>> a.mod(b, fill_value=0)
204
146
a 0.0
205
147
b NaN
@@ -208,23 +150,7 @@ def _make_flex_doc(op_name, typ):
208
150
e NaN
209
151
dtype: float64
210
152
"""
211
- _pow_example_SERIES = """
212
- Examples
213
- --------
214
- >>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
215
- >>> a
216
- a 1.0
217
- b 1.0
218
- c 1.0
219
- d NaN
220
- dtype: float64
221
- >>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
222
- >>> b
223
- a 1.0
224
- b NaN
225
- d 1.0
226
- e NaN
227
- dtype: float64
153
+ _pow_example_SERIES = _common_examples_SERIES + """
228
154
>>> a.pow(b, fill_value=0)
229
155
a 1.0
230
156
b 1.0
@@ -234,83 +160,27 @@ def _make_flex_doc(op_name, typ):
234
160
dtype: float64
235
161
"""
236
162
237
- _ne_example_SERIES = """
238
- Examples
239
- --------
240
- >>> a = pd.Series([1, 1, np.nan, np.nan, 0], index=['a', 'b', 'c', 'd', 'e'])
241
- >>> a
242
- a 1.0
243
- b 1.0
244
- c 1.0
245
- d NaN
246
- e 1.0
247
- dtype: float64
248
- >>> b = pd.Series([0, 1, np.nan, 0, 1], index=['a', 'b', 'c', 'd', 'f'])
249
- >>> b
250
- a 0.0
251
- b 1.0
252
- c 2.0
253
- d NaN
254
- f 1.0
255
- dtype: float64
163
+ _ne_example_SERIES = _common_examples_SERIES + """
256
164
>>> a.ne(b, fill_value=0)
257
- a True
258
- b False
165
+ a False
166
+ b True
259
167
c True
260
- d False
261
- e False
262
- f True
168
+ d True
169
+ e True
263
170
dtype: bool
264
171
"""
265
172
266
- _eq_example_SERIES = """
267
- Examples
268
- --------
269
- >>> a = pd.Series([1, 1, np.nan, np.nan, 0], index=['a', 'b', 'c', 'd', 'e'])
270
- >>> a
271
- a 1.0
272
- b 1.0
273
- c 1.0
274
- d NaN
275
- e 1.0
276
- dtype: float64
277
- >>> b = pd.Series([0, 1, np.nan, 0, 1], index=['a', 'b', 'c', 'd', 'f'])
278
- >>> b
279
- a 0.0
280
- b 1.0
281
- c 2.0
282
- d NaN
283
- f 1.0
284
- dtype: float64
173
+ _eq_example_SERIES = _common_examples_SERIES + """
285
174
>>> a.eq(b, fill_value=0)
286
- a False
287
- b True
175
+ a True
176
+ b False
288
177
c False
289
- d True
290
- e True
291
- f False
178
+ d False
179
+ e False
292
180
dtype: bool
293
181
"""
294
182
295
- _lt_example_SERIES = """
296
- Examples
297
- --------
298
- >>> a = pd.Series([1, 1, 1, np.nan, 1], index=['a', 'b', 'c', 'd', 'e'])
299
- >>> a
300
- a 1.0
301
- b 1.0
302
- c 1.0
303
- d NaN
304
- e 1.0
305
- dtype: float64
306
- >>> b = pd.Series([0, 1, 2, np.nan, 1], index=['a', 'b', 'c', 'd', 'f'])
307
- >>> b
308
- a 0.0
309
- b 1.0
310
- c 2.0
311
- d NaN
312
- f 1.0
313
- dtype: float64
183
+ _lt_example_SERIES = _common_examples_comparison_SERIES + """
314
184
>>> a.lt(b, fill_value=0)
315
185
a False
316
186
b False
@@ -321,25 +191,7 @@ def _make_flex_doc(op_name, typ):
321
191
dtype: bool
322
192
"""
323
193
324
- _le_example_SERIES = """
325
- Examples
326
- --------
327
- >>> a = pd.Series([1, 1, 1, np.nan, 1], index=['a', 'b', 'c', 'd', 'e'])
328
- >>> a
329
- a 1.0
330
- b 1.0
331
- c 1.0
332
- d NaN
333
- e 1.0
334
- dtype: float64
335
- >>> b = pd.Series([0, 1, 2, np.nan, 1], index=['a', 'b', 'c', 'd', 'f'])
336
- >>> b
337
- a 0.0
338
- b 1.0
339
- c 2.0
340
- d NaN
341
- f 1.0
342
- dtype: float64
194
+ _le_example_SERIES = _common_examples_comparison_SERIES + """
343
195
>>> a.le(b, fill_value=0)
344
196
a False
345
197
b True
@@ -350,25 +202,7 @@ def _make_flex_doc(op_name, typ):
350
202
dtype: bool
351
203
"""
352
204
353
- _gt_example_SERIES = """
354
- Examples
355
- --------
356
- >>> a = pd.Series([1, 1, 1, np.nan, 1], index=['a', 'b', 'c', 'd', 'e'])
357
- >>> a
358
- a 1.0
359
- b 1.0
360
- c 1.0
361
- d NaN
362
- e 1.0
363
- dtype: float64
364
- >>> b = pd.Series([0, 1, 2, np.nan, 1], index=['a', 'b', 'c', 'd', 'f'])
365
- >>> b
366
- a 0.0
367
- b 1.0
368
- c 2.0
369
- d NaN
370
- f 1.0
371
- dtype: float64
205
+ _gt_example_SERIES = _common_examples_comparison_SERIES + """
372
206
>>> a.gt(b, fill_value=0)
373
207
a True
374
208
b False
@@ -379,25 +213,7 @@ def _make_flex_doc(op_name, typ):
379
213
dtype: bool
380
214
"""
381
215
382
- _ge_example_SERIES = """
383
- Examples
384
- --------
385
- >>> a = pd.Series([1, 1, 1, np.nan, 1], index=['a', 'b', 'c', 'd', 'e'])
386
- >>> a
387
- a 1.0
388
- b 1.0
389
- c 1.0
390
- d NaN
391
- e 1.0
392
- dtype: float64
393
- >>> b = pd.Series([0, 1, 2, np.nan, 1], index=['a', 'b', 'c', 'd', 'f'])
394
- >>> b
395
- a 0.0
396
- b 1.0
397
- c 2.0
398
- d NaN
399
- f 1.0
400
- dtype: float64
216
+ _ge_example_SERIES = _common_examples_comparison_SERIES + """
401
217
>>> a.ge(b, fill_value=0)
402
218
a True
403
219
b True
0 commit comments