Skip to content

Commit 408ffad

Browse files
committed
add docstring, use ABCSeries
1 parent 45c8c4a commit 408ffad

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

pandas/core/missing.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
needs_i8_conversion, is_integer,
1616
is_period_arraylike)
1717
from pandas.types.missing import isnull, valid_fill_value
18+
from pandas.types.generic import ABCSeries
1819

1920

2021
def mask_missing(arr, values_to_mask):
@@ -626,10 +627,38 @@ def fill_zeros(result, x, y, name, fill):
626627

627628
def maybe_fill(obj, value, errors):
628629
"""
630+
631+
Fillna error coercion routine.
632+
633+
Construct a piecewise polynomial in the Bernstein basis, compatible
634+
with the specified values and derivatives at breakpoints.
635+
636+
Parameters
637+
----------
638+
obj : Series of DataFrame
639+
The Series or DataFrame for which a fill value is being evaluated.
640+
If obj is a DataFrame this method simply returns True (e.g. the fillna
641+
operation is allowed to continue) because it will be broken up and
642+
parsed as a sequence of sub-Series later on.
643+
value : object
644+
The value to be used as a fill for the object.
645+
errors : {'raise', 'coerce', or 'ignore'}
646+
How invalid fill values will be handled. If 'raise', a TypeError will
647+
be raised. If 'coerce', the column need to be coerced to a more
648+
general dtype; the fillna op simply continues. If 'ignore', the fill
649+
value will not be applied to the column: this method will pass fillna
650+
a flag that tells it to terminate immediately.
651+
652+
Returns
653+
-------
654+
continue : bool
655+
Whether or not, based on the values and the error mode, the fill
656+
operation ought to continue.
657+
"""
658+
"""
629659
fillna error coercion routine, returns whether or not to continue.
630660
"""
631-
from pandas import Series
632-
if isinstance(obj, Series):
661+
if isinstance(obj, ABCSeries):
633662
if errors is None or errors == 'coerce':
634663
return True
635664
else:

0 commit comments

Comments
 (0)