|
15 | 15 | needs_i8_conversion, is_integer,
|
16 | 16 | is_period_arraylike)
|
17 | 17 | from pandas.types.missing import isnull, valid_fill_value
|
| 18 | +from pandas.types.generic import ABCSeries |
18 | 19 |
|
19 | 20 |
|
20 | 21 | def mask_missing(arr, values_to_mask):
|
@@ -622,10 +623,38 @@ def fill_zeros(result, x, y, name, fill):
|
622 | 623 |
|
623 | 624 | def maybe_fill(obj, value, errors):
|
624 | 625 | """
|
| 626 | +
|
| 627 | + Fillna error coercion routine. |
| 628 | +
|
| 629 | + Construct a piecewise polynomial in the Bernstein basis, compatible |
| 630 | + with the specified values and derivatives at breakpoints. |
| 631 | +
|
| 632 | + Parameters |
| 633 | + ---------- |
| 634 | + obj : Series of DataFrame |
| 635 | + The Series or DataFrame for which a fill value is being evaluated. |
| 636 | + If obj is a DataFrame this method simply returns True (e.g. the fillna |
| 637 | + operation is allowed to continue) because it will be broken up and |
| 638 | + parsed as a sequence of sub-Series later on. |
| 639 | + value : object |
| 640 | + The value to be used as a fill for the object. |
| 641 | + errors : {'raise', 'coerce', or 'ignore'} |
| 642 | + How invalid fill values will be handled. If 'raise', a TypeError will |
| 643 | + be raised. If 'coerce', the column need to be coerced to a more |
| 644 | + general dtype; the fillna op simply continues. If 'ignore', the fill |
| 645 | + value will not be applied to the column: this method will pass fillna |
| 646 | + a flag that tells it to terminate immediately. |
| 647 | +
|
| 648 | + Returns |
| 649 | + ------- |
| 650 | + continue : bool |
| 651 | + Whether or not, based on the values and the error mode, the fill |
| 652 | + operation ought to continue. |
| 653 | + """ |
| 654 | + """ |
625 | 655 | fillna error coercion routine, returns whether or not to continue.
|
626 | 656 | """
|
627 |
| - from pandas import Series |
628 |
| - if isinstance(obj, Series): |
| 657 | + if isinstance(obj, ABCSeries): |
629 | 658 | if errors is None or errors == 'coerce':
|
630 | 659 | return True
|
631 | 660 | else:
|
|
0 commit comments