Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX-#6968: Align API with pandas #6969

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ dependencies:
- pip

# required dependencies
- pandas>=2.2,<2.3
# excluding 2.2.0 because of https://github.com/modin-project/modin/issues/6968
- pandas>=2.2,<2.3,!=2.2.0
dchigarev marked this conversation as resolved.
Show resolved Hide resolved
- numpy>=1.22.4
- fsspec>=2022.11.0
- packaging>=21.0
Expand Down
24 changes: 22 additions & 2 deletions modin/pandas/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,14 +682,34 @@
)
)

def first(self, numeric_only=False, min_count=-1):
def first(self, numeric_only=False, min_count=-1, skipna=True):
# TODO: check if it works properly if we simply pass 'skipna' to
# the query compiler level
if not skipna:
return self._default_to_pandas(

Check warning on line 689 in modin/pandas/groupby.py

View check run for this annotation

Codecov / codecov/patch

modin/pandas/groupby.py#L689

Added line #L689 was not covered by tests
YarShev marked this conversation as resolved.
Show resolved Hide resolved
lambda df: df.first(
numeric_only=numeric_only,
min_count=min_count,
skipna=skipna,
)
)
return self._wrap_aggregation(
type(self._query_compiler).groupby_first,
agg_kwargs=dict(min_count=min_count),
numeric_only=numeric_only,
)

def last(self, numeric_only=False, min_count=-1):
def last(self, numeric_only=False, min_count=-1, skipna=True):
# TODO: check if it works properly if we simply pass 'skipna' to
# the query compiler level
if not skipna:
return self._default_to_pandas(

Check warning on line 706 in modin/pandas/groupby.py

View check run for this annotation

Codecov / codecov/patch

modin/pandas/groupby.py#L706

Added line #L706 was not covered by tests
dchigarev marked this conversation as resolved.
Show resolved Hide resolved
lambda df: df.first(
numeric_only=numeric_only,
min_count=min_count,
skipna=skipna,
)
)
return self._wrap_aggregation(
type(self._query_compiler).groupby_last,
agg_kwargs=dict(min_count=min_count),
Expand Down
10 changes: 8 additions & 2 deletions modin/pandas/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,13 +706,19 @@ def argmin(self, axis=None, skipna=True, *args, **kwargs): # noqa: PR01, RT01,
result = -1
return result

def argsort(self, axis=0, kind="quicksort", order=None): # noqa: PR01, RT01, D200
def argsort(
self, axis=0, kind="quicksort", order=None, stable=None
): # noqa: PR01, RT01, D200
"""
Return the integer indices that would sort the Series values.
"""
return self.__constructor__(
query_compiler=self._query_compiler.argsort(
axis=axis, kind=kind, order=order
# 'stable' parameter has no effect in Pandas and is only accepted
# for compatibility with NumPy, so we're not passing it forward on purpose
axis=axis,
kind=kind,
order=order,
)
)

Expand Down
3 changes: 2 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## required dependencies
pandas>=2.2,<2.3
# excluding 2.2.0 because of https://github.com/modin-project/modin/issues/6968
pandas>=2.2,<2.3,!=2.2.0
numpy>=1.22.4
fsspec>=2022.11.0
packaging>=21.0
Expand Down
2 changes: 1 addition & 1 deletion requirements/env_hdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies:
- pip

# required dependencies
- pandas>=2.2,<2.3
- pandas>=2.2,<2.3,!=2.2.0
- numpy>=1.22.4
- pyhdk==0.9
- fsspec>=2022.11.0
Expand Down
3 changes: 2 additions & 1 deletion requirements/env_unidist_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ dependencies:
- pip

# required dependencies
- pandas>=2.2,<2.3
# excluding 2.2.0 because of https://github.com/modin-project/modin/issues/6968
- pandas>=2.2,<2.3,!=2.2.0
- numpy>=1.22.4
- unidist-mpi>=0.2.1
- mpich
Expand Down
3 changes: 2 additions & 1 deletion requirements/env_unidist_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ dependencies:
- pip

# required dependencies
- pandas>=2.2,<2.3
# excluding 2.2.0 because of https://github.com/modin-project/modin/issues/6968
- pandas>=2.2,<2.3,!=2.2.0
- numpy>=1.22.4
- unidist-mpi>=0.2.1
- msmpi
Expand Down
3 changes: 2 additions & 1 deletion requirements/requirements-no-engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ dependencies:
- pip

# required dependencies
- pandas>=2.2,<2.3
# excluding 2.2.0 because of https://github.com/modin-project/modin/issues/6968
- pandas>=2.2,<2.3,!=2.2.0
- numpy>=1.22.4
- fsspec>=2022.11.0
- packaging>=21.0
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def make_distribution(self):
long_description=long_description,
long_description_content_type="text/markdown",
install_requires=[
"pandas>=2.2,<2.3",
# excluding 2.2.0 because of https://github.com/modin-project/modin/issues/6968
"pandas>=2.2,<2.3,!=2.2.0",
"packaging>=21.0",
"numpy>=1.22.4",
"fsspec>=2022.11.0",
Expand Down