Skip to content

Commit c30b777

Browse files
committed
add docstring, use ABCSeries
1 parent b3d5471 commit c30b777

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

Diff for: pandas/core/missing.py

+31-2
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):
@@ -622,10 +623,38 @@ def fill_zeros(result, x, y, name, fill):
622623

623624
def maybe_fill(obj, value, errors):
624625
"""
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+
"""
625655
fillna error coercion routine, returns whether or not to continue.
626656
"""
627-
from pandas import Series
628-
if isinstance(obj, Series):
657+
if isinstance(obj, ABCSeries):
629658
if errors is None or errors == 'coerce':
630659
return True
631660
else:

0 commit comments

Comments
 (0)