Skip to content

Commit

Permalink
fix series
Browse files Browse the repository at this point in the history
  • Loading branch information
noloerino committed Aug 21, 2024
1 parent f4e55be commit d1c2f28
Showing 1 changed file with 58 additions and 32 deletions.
90 changes: 58 additions & 32 deletions modin/polars/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __repr__(self):
_descending = None

def to_pandas(self) -> ModinPandasSeries:
return ModinPandasSeries(data=self._query_compiler)
return ModinPandasSeries(query_compiler=self._query_compiler)

def arg_max(self) -> int:
"""
Expand Down Expand Up @@ -295,7 +295,7 @@ def not_(self) -> "Series":
Returns:
Negated Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.invert())
return self.__constructor__(_query_compiler=self._query_compiler.invert())

@property
def cat(self):
Expand All @@ -308,7 +308,7 @@ def abs(self) -> "Series":
Returns:
Absolute values Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.abs())
return self.__constructor__(_query_compiler=self._query_compiler.abs())

def arccos(self) -> "Series":
"""
Expand Down Expand Up @@ -372,7 +372,7 @@ def arg_true(self) -> "Series":
Index of the first True value.
"""
return self.__constructor__(
_query_compiler==self._query_compiler.reset_index(drop=False)
_query_compiler=self._query_compiler.reset_index(drop=False)
.getitem_array(self._query_compiler)
.getitem_column_array(0, numeric=True)
).rename(self.name)
Expand Down Expand Up @@ -429,7 +429,9 @@ def cum_count(self) -> "Series":
Returns:
Cumulative count values Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.isna().cumsum())
return self.__constructor__(
_query_compiler=self._query_compiler.isna().cumsum()
)

def cum_max(self) -> "Series":
"""
Expand All @@ -438,7 +440,7 @@ def cum_max(self) -> "Series":
Returns:
Cumulative maximum values Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.cummax())
return self.__constructor__(_query_compiler=self._query_compiler.cummax())

def cum_min(self) -> "Series":
"""
Expand All @@ -447,7 +449,7 @@ def cum_min(self) -> "Series":
Returns:
Cumulative minimum values Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.cummin())
return self.__constructor__(_query_compiler=self._query_compiler.cummin())

def cum_prod(self) -> "Series":
"""
Expand All @@ -456,7 +458,7 @@ def cum_prod(self) -> "Series":
Returns:
Cumulative product values Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.cumprod())
return self.__constructor__(_query_compiler=self._query_compiler.cumprod())

def cum_sum(self) -> "Series":
"""
Expand All @@ -465,7 +467,7 @@ def cum_sum(self) -> "Series":
Returns:
Cumulative sum values Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.cumsum())
return self.__constructor__(_query_compiler=self._query_compiler.cumsum())

def cumulative_eval(
self, expr, min_periods: int = 1, *, parallel: bool = False
Expand Down Expand Up @@ -1254,7 +1256,7 @@ def is_nan(self) -> "Series":
Returns:
True if the values are NaN, False otherwise.
"""
return self.__constructor__(_query_compiler==self._query_compiler.isna())
return self.__constructor__(_query_compiler=self._query_compiler.isna())

def is_not_nan(self) -> "Series":
"""
Expand All @@ -1263,7 +1265,7 @@ def is_not_nan(self) -> "Series":
Returns:
True if the values are not NaN, False otherwise.
"""
return self.__constructor__(_query_compiler==self._query_compiler.notna())
return self.__constructor__(_query_compiler=self._query_compiler.notna())

def is_not_null(self) -> "Series":
"""
Expand Down Expand Up @@ -1376,7 +1378,7 @@ def to_frame(self, name: str | None = None) -> "DataFrame":
"""
from modin.polars import DataFrame

return DataFrame(_query_compiler==self._query_compiler).rename({self.name: name})
return DataFrame(_query_compiler=self._query_compiler).rename({self.name: name})

def to_init_repr(self, n: int = 1000) -> str:
"""
Expand Down Expand Up @@ -1421,7 +1423,7 @@ def append(self, other: "Series") -> "Series":
Appended Series.
"""
return self.__constructor__(
_query_compiler==self._query_compiler.concat(0, other._query_compiler)
_query_compiler=self._query_compiler.concat(0, other._query_compiler)
)

def arg_sort(
Expand Down Expand Up @@ -1730,7 +1732,7 @@ def zip_with(self, mask: "Series", other: "Series") -> "Series":
Zipped Series.
"""
return self.__constructor__(
_query_compiler==self._query_compiler.where(
_query_compiler=self._query_compiler.where(
mask._query_compiler, other._query_compiler
)
)
Expand Down Expand Up @@ -1847,7 +1849,9 @@ def __radd__(self, other) -> "Series":
Returns:
Added Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.radd(other, axis=0))
return self.__constructor__(
_query_compiler=self._query_compiler.radd(other, axis=0)
)

def __rand__(self, other) -> "Series":
"""
Expand All @@ -1859,7 +1863,9 @@ def __rand__(self, other) -> "Series":
Returns:
And Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.__rand__(other, axis=0))
return self.__constructor__(
_query_compiler=self._query_compiler.__rand__(other, axis=0)
)

def __rfloordiv__(self, other) -> "Series":
"""
Expand All @@ -1871,7 +1877,9 @@ def __rfloordiv__(self, other) -> "Series":
Returns:
Floored Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.rfloordiv(other, axis=0))
return self.__constructor__(
_query_compiler=self._query_compiler.rfloordiv(other, axis=0)
)

def __rmatmul__(self, other) -> "Series":
"""
Expand All @@ -1895,7 +1903,9 @@ def __rmod__(self, other) -> "Series":
Returns:
Modulo Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.rmod(other, axis=0))
return self.__constructor__(
_query_compiler=self._query_compiler.rmod(other, axis=0)
)

def __rmul__(self, other) -> "Series":
"""
Expand All @@ -1907,7 +1917,9 @@ def __rmul__(self, other) -> "Series":
Returns:
Multiplied Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.rmul(other, axis=0))
return self.__constructor__(
_query_compiler=self._query_compiler.rmul(other, axis=0)
)

def __ror__(self, other) -> "Series":
"""
Expand All @@ -1919,7 +1931,9 @@ def __ror__(self, other) -> "Series":
Returns:
Or Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.__ror__(other, axis=0))
return self.__constructor__(
_query_compiler=self._query_compiler.__ror__(other, axis=0)
)

def __rpow__(self, other) -> "Series":
"""
Expand All @@ -1931,7 +1945,9 @@ def __rpow__(self, other) -> "Series":
Returns:
Powered Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.rpow(other, axis=0))
return self.__constructor__(
_query_compiler=self._query_compiler.rpow(other, axis=0)
)

def __rsub__(self, other) -> "Series":
"""
Expand All @@ -1943,7 +1959,9 @@ def __rsub__(self, other) -> "Series":
Returns:
Subtracted Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.rsub(other, axis=0))
return self.__constructor__(
_query_compiler=self._query_compiler.rsub(other, axis=0)
)

def __rtruediv__(self, other) -> "Series":
"""
Expand All @@ -1955,7 +1973,9 @@ def __rtruediv__(self, other) -> "Series":
Returns:
Divided Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.rtruediv(other, axis=0))
return self.__constructor__(
_query_compiler=self._query_compiler.rtruediv(other, axis=0)
)

def __rxor__(self, other) -> "Series":
"""
Expand All @@ -1967,7 +1987,9 @@ def __rxor__(self, other) -> "Series":
Returns:
Xor Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.__rxor__(other, axis=0))
return self.__constructor__(
_query_compiler=self._query_compiler.__rxor__(other, axis=0)
)

def eq(self, other) -> "Series":
"""
Expand All @@ -1980,7 +2002,7 @@ def eq(self, other) -> "Series":
Boolean Series.
"""
return self.__constructor__(
_query_compiler==self._query_compiler.eq(other._query_compiler)
_query_compiler=self._query_compiler.eq(other._query_compiler)
)

def eq_missing(self, other) -> "Series":
Expand All @@ -2006,7 +2028,7 @@ def ge(self, other) -> "Series":
Boolean Series.
"""
return self.__constructor__(
_query_compiler==self._query_compiler.ge(other._query_compiler)
_query_compiler=self._query_compiler.ge(other._query_compiler)
)

def gt(self, other) -> "Series":
Expand All @@ -2020,7 +2042,7 @@ def gt(self, other) -> "Series":
Boolean Series.
"""
return self.__constructor__(
_query_compiler==self._query_compiler.gt(other._query_compiler)
_query_compiler=self._query_compiler.gt(other._query_compiler)
)

def le(self, other) -> "Series":
Expand All @@ -2034,7 +2056,7 @@ def le(self, other) -> "Series":
Boolean Series.
"""
return self.__constructor__(
_query_compiler==self._query_compiler.le(other._query_compiler)
_query_compiler=self._query_compiler.le(other._query_compiler)
)

def lt(self, other) -> "Series":
Expand All @@ -2048,7 +2070,7 @@ def lt(self, other) -> "Series":
Boolean Series.
"""
return self.__constructor__(
_query_compiler==self._query_compiler.lt(other._query_compiler)
_query_compiler=self._query_compiler.lt(other._query_compiler)
)

def n_unique(self) -> int:
Expand All @@ -2071,7 +2093,7 @@ def ne(self, other) -> "Series":
Boolean Series.
"""
return self.__constructor__(
_query_compiler==self._query_compiler.ne(other._query_compiler)
_query_compiler=self._query_compiler.ne(other._query_compiler)
)

def ne_missing(self, other) -> "Series":
Expand All @@ -2096,7 +2118,9 @@ def pow(self, exponent) -> "Series":
Returns:
Powered Series.
"""
return self.__constructor__(_query_compiler==self._query_compiler.pow(exponent, axis=0))
return self.__constructor__(
_query_compiler=self._query_compiler.pow(exponent, axis=0)
)

def replace_strict(
self, old, new=no_default, *, default=no_default, return_dtype=None
Expand Down Expand Up @@ -2130,4 +2154,6 @@ def drop_nans(self) -> "Series":
Returns:
Series without NaN values.
"""
return self.__constructor__(_query_compiler==self._query_compiler.dropna(how="any"))
return self.__constructor__(
_query_compiler=self._query_compiler.dropna(how="any")
)

0 comments on commit d1c2f28

Please sign in to comment.