Skip to content

Commit

Permalink
API fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
  • Loading branch information
anmyachev committed Feb 7, 2024
1 parent 50caeb4 commit 2c50992
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
38 changes: 34 additions & 4 deletions modin/pandas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,11 +1106,26 @@ def _deprecate_downcast(self, downcast, method_name: str):
return downcast

def bfill(
self, *, axis=None, inplace=False, limit=None, downcast=lib.no_default
self,
*,
axis=None,
inplace=False,
limit=None,
limit_area=None,
downcast=lib.no_default,
): # noqa: PR01, RT01, D200
"""
Synonym for `DataFrame.fillna` with ``method='bfill'``.
"""
if limit_area is not None:
return self._default_to_pandas(

Check warning on line 1121 in modin/pandas/base.py

View check run for this annotation

Codecov / codecov/patch

modin/pandas/base.py#L1120-L1121

Added lines #L1120 - L1121 were not covered by tests
"bfill",
axis=axis,
inplace=inplace,
limit=limit,
limit_area=limit_area,
downcast=downcast,
)
downcast = self._deprecate_downcast(downcast, "bfill")
with warnings.catch_warnings():
warnings.filterwarnings(
Expand Down Expand Up @@ -1599,11 +1614,26 @@ def expanding(
)

def ffill(
self, *, axis=None, inplace=False, limit=None, downcast=lib.no_default
self,
*,
axis=None,
inplace=False,
limit=None,
limit_area=None,
downcast=lib.no_default,
): # noqa: PR01, RT01, D200
"""
Synonym for `DataFrame.fillna` with ``method='ffill'``.
"""
if limit_area is not None:
return self._default_to_pandas(

Check warning on line 1629 in modin/pandas/base.py

View check run for this annotation

Codecov / codecov/patch

modin/pandas/base.py#L1628-L1629

Added lines #L1628 - L1629 were not covered by tests
"ffill",
axis=axis,
inplace=inplace,
limit=limit,
limit_area=limit_area,
downcast=downcast,
)
downcast = self._deprecate_downcast(downcast, "ffill")
with warnings.catch_warnings():
warnings.filterwarnings(
Expand Down Expand Up @@ -2489,8 +2519,8 @@ def resample(
axis: Axis = lib.no_default,
closed: Optional[str] = None,
label: Optional[str] = None,
convention: str = "start",
kind: Optional[str] = None,
convention: str = lib.no_default,
kind: Optional[str] = lib.no_default,
on: Level = None,
level: Level = None,
origin: Union[str, TimestampConvertibleTypes] = "start_day",
Expand Down
8 changes: 6 additions & 2 deletions modin/pandas/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,12 +394,14 @@ def apply(
result_type=None,
args=(),
by_row="compat",
engine="python",
engine_kwargs=None,
**kwargs,
): # noqa: PR01, RT01, D200
"""
Apply a function along an axis of the ``DataFrame``.
"""
if by_row != "compat":
if by_row != "compat" or engine != "python":
# TODO: add test
return self._default_to_pandas(
pandas.DataFrame.apply,
Expand All @@ -409,6 +411,8 @@ def apply(
result_type=result_type,
args=args,
by_row=by_row,
engine=engine,
engine_kwargs=engine_kwargs,
**kwargs,
)

Expand Down Expand Up @@ -1446,7 +1450,7 @@ def pivot_table(
margins=False,
dropna=True,
margins_name="All",
observed=False,
observed=lib.no_default,
sort=True,
): # noqa: PR01, RT01, D200
"""
Expand Down
4 changes: 2 additions & 2 deletions modin/pandas/series_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

@_inherit_docstrings(pandas.core.arrays.arrow.ListAccessor)
class ListAccessor(ClassLogger):
def __init__(self, data):
def __init__(self, data=None):
self._series = data
self._query_compiler = data._query_compiler

Check warning on line 38 in modin/pandas/series_utils.py

View check run for this annotation

Codecov / codecov/patch

modin/pandas/series_utils.py#L37-L38

Added lines #L37 - L38 were not covered by tests

Expand Down Expand Up @@ -71,7 +71,7 @@ def _default_to_pandas(self, op, *args, **kwargs):

@_inherit_docstrings(pandas.core.arrays.arrow.StructAccessor)
class StructAccessor(ClassLogger):
def __init__(self, data):
def __init__(self, data=None):
self._series = data
self._query_compiler = data._query_compiler

Check warning on line 76 in modin/pandas/series_utils.py

View check run for this annotation

Codecov / codecov/patch

modin/pandas/series_utils.py#L75-L76

Added lines #L75 - L76 were not covered by tests

Expand Down

0 comments on commit 2c50992

Please sign in to comment.