id stringlengths 30 32 | content stringlengths 139 2.8k |
|---|---|
codereview_new_python_data_10667 | def test_repartition(axis, dtype):
if dtype == "DataFrame":
results = {
- None: ([4, 0, 0, 0], [3, 0, 0, 0]),
- 0: ([4, 0, 0, 0], [2, 1]),
- 1: ([2, 2], [3, 0, 0, 0]),
}
else:
results = {
- None: ([4, 0, 0, 0], [1]),
- 0: ([4... |
codereview_new_python_data_10668 | def apply_full_axis(
Setting it to True disables shuffling data from one partition to another.
synchronize : boolean, default: True
Synchronize external indexes (`new_index`, `new_columns`) with internal indexes.
Returns
-------
```suggestion
Synchro... |
codereview_new_python_data_10669 | def repartition(self, axis=None):
new_index=self._modin_frame._index_cache,
new_columns=self._modin_frame._columns_cache,
keep_partitioning=False,
- synchronize=False,
)
)
return new_query_compiler
... |
codereview_new_python_data_10670 | def check_parameters_support(
if read_kwargs.get("skipfooter"):
if read_kwargs.get("nrows") or read_kwargs.get("engine") == "c":
- return (False, "raise exception by pandas itself")
skiprows_supported = True
if is_list_like(skiprows_md) and skiprows_md[0] < he... |
codereview_new_python_data_10671 | def _read_csv_check_support(
)
if read_csv_kwargs.get("skipfooter") and read_csv_kwargs.get("nrows"):
- return (False, "raise exception by pandas itself")
for arg, def_value in cls.read_csv_unsup_defaults.items():
if read_csv_kwargs[arg] != def_value:
```... |
codereview_new_python_data_10672 | def _read(cls, io, **kwargs):
if index_col is not None:
column_names = column_names.drop(column_names[index_col])
- if not all(column_names) or kwargs["usecols"]:
# some column names are empty, use pandas reader to take the names from it
pand... |
codereview_new_python_data_10673 | def _read(cls, io, **kwargs):
if index_col is not None:
column_names = column_names.drop(column_names[index_col])
- if not all(column_names) or kwargs["usecols"]:
# some column names are empty, use pandas reader to take the names from it
pand... |
codereview_new_python_data_10674 | def modin_df_almost_equals_pandas(modin_df, pandas_df):
)
-def try_almost_equals_compare(df1, df2):
"""Compare two dataframes as nearly equal if possible, otherwise compare as completely equal."""
# `modin_df_almost_equals_pandas` is numeric-only comparator
dtypes1, dtypes2 = map(
```suggestio... |
codereview_new_python_data_10675 | def walk(
elif depth == 1:
if len(value) != 2:
raise ValueError(
- f"Incorrect rename format. Renamer must consist of exactly two elements, got {len(value)=}."
)
func_name, func = value
yiel... |
codereview_new_python_data_10676 | def try_modin_df_almost_equals_compare(df1, df2):
if all(is_numeric_dtype(dtype) for dtype in dtypes1) and all(
is_numeric_dtype(dtype) for dtype in dtypes2
):
- return modin_df_almost_equals_pandas(df1, df2)
- else:
- return df_equals(df1, df2)
def df_is_empty(df):
To fix Cod... |
codereview_new_python_data_10677 | def try_modin_df_almost_equals_compare(df1, df2):
if all(is_numeric_dtype(dtype) for dtype in dtypes1) and all(
is_numeric_dtype(dtype) for dtype in dtypes2
):
- return modin_df_almost_equals_pandas(df1, df2)
- else:
- return df_equals(df1, df2)
def df_is_empty(df):
`df_equals... |
codereview_new_python_data_10678 | def try_modin_df_almost_equals_compare(df1, df2):
is_numeric_dtype(dtype) for dtype in dtypes2
):
modin_df_almost_equals_pandas(df1, df2)
df_equals(df1, df2)
```suggestion
modin_df_almost_equals_pandas(df1, df2)
else:
df_equals(df1, df2)
```
def try_modin_... |
codereview_new_python_data_10679 | def groupby_agg(
# Defaulting to pandas in case of an empty frame as we can't process it properly.
# Higher API level won't pass empty data here unless the frame has delayed
# computations. So we apparently lose some laziness here (due to index access)
- # because of the disability to... |
codereview_new_python_data_10680 | def modin_df_almost_equals_pandas(modin_df, pandas_df):
def try_modin_df_almost_equals_compare(df1, df2):
"""Compare two dataframes as nearly equal if possible, otherwise compare as completely equal."""
# `modin_df_almost_equals_pandas` is numeric-only comparator
- dtypes1, dtypes2 = map(
- lambda... |
codereview_new_python_data_10681 | def modin_df_almost_equals_pandas(modin_df, pandas_df):
def try_modin_df_almost_equals_compare(df1, df2):
"""Compare two dataframes as nearly equal if possible, otherwise compare as completely equal."""
# `modin_df_almost_equals_pandas` is numeric-only comparator
- dtypes1, dtypes2 = map(
- lambda... |
codereview_new_python_data_10682 | def test___gt__(data):
@pytest.mark.parametrize("count_elements", [0, 1, 10])
-@pytest.mark.parametrize("converter", [int, float])
-def test___int__and__float__(converter, count_elements):
eval_general(
*create_test_series(test_data["int_data"]),
- lambda df: converter(df[:count_elements]),
... |
codereview_new_python_data_10683 | def test___gt__(data):
@pytest.mark.parametrize("count_elements", [0, 1, 10])
def test___int__(count_elements):
eval_general(
- *create_test_series(test_data["float_nan_data"]),
- lambda df: int(df[:count_elements]),
)
@pytest.mark.parametrize("count_elements", [0, 1, 10])
def test___fl... |
codereview_new_python_data_10684 | def test___gt__(data):
@pytest.mark.parametrize("count_elements", [0, 1, 10])
def test___int__(count_elements):
- eval_general(
- *create_test_series([1.5] * count_elements),
- lambda df: int(df),
- )
@pytest.mark.parametrize("count_elements", [0, 1, 10])
def test___float__(count_elements... |
codereview_new_python_data_10685 | def test___gt__(data):
@pytest.mark.parametrize("count_elements", [0, 1, 10])
def test___int__(count_elements):
- eval_general(
- *create_test_series([1.5] * count_elements),
- lambda df: int(df),
- )
@pytest.mark.parametrize("count_elements", [0, 1, 10])
def test___float__(count_elements... |
codereview_new_python_data_10686 | def show_versions(as_json: Union[str, bool] = False) -> None:
print(f"{k:<{maxlen}}: {v}")
-def int_to_float32(dtype: np.dtype) -> np.dtype:
"""
Check if a datatype is a variant of integer.
- If dtype is integer function returns float32 datatype if not returns the
argument data... |
codereview_new_python_data_10687 | def show_versions(as_json: Union[str, bool] = False) -> None:
print(f"{k:<{maxlen}}: {v}")
-def int_to_float32(dtype: np.dtype) -> np.dtype:
"""
Check if a datatype is a variant of integer.
- If dtype is integer function returns float32 datatype if not returns the
argument data... |
codereview_new_python_data_10688 | def compute_dtypes_common_cast(first, second) -> np.dtype:
-----
The dtypes of the operands are supposed to be known.
"""
- dtypes_first = dict(zip(first.columns, first._modin_frame._dtypes))
- dtypes_second = dict(zip(second.columns, second._modin_frame._dtypes))
columns_first = set(first.co... |
codereview_new_python_data_10689 | def values(self): # noqa: RT01, D200
"""
import modin.pandas as pd
- if isinstance(self.dtype, pandas.core.dtypes.dtypes.ExtensionDtype):
return self._default_to_pandas("values")
data = self.to_numpy()
Modin doesn't have `core` module.
def values(self): # noqa: R... |
codereview_new_python_data_10690 | def partitioned_file(
List with the next elements:
int : partition start read byte
int : partition end read byte
- pandas.DataFrame
Dataframe from which metadata can be retrieved. Can be None if `read_callback_kw=None`.
"""
if read_ca... |
codereview_new_python_data_10691 | def default_to_pandas(self, pandas_op, *args, **kwargs):
"""
op_name = getattr(pandas_op, "__name__", str(pandas_op))
ErrorMessage.default_to_pandas(op_name)
- args = (a.to_pandas() if isinstance(a, type(self)) else a for a in args)
- kwargs = {
- k: v.to_pandas() if... |
codereview_new_python_data_10692 | def default_to_pandas(self, pandas_op, *args, **kwargs):
"""
op_name = getattr(pandas_op, "__name__", str(pandas_op))
ErrorMessage.default_to_pandas(op_name)
- args = (a.to_pandas() if isinstance(a, type(self)) else a for a in args)
- kwargs = {
- k: v.to_pandas() if... |
codereview_new_python_data_10693 | def from_labels(self) -> "PandasDataframe":
if "index" not in self.columns
else "level_{}".format(0)
]
- names = tuple(level_names) if len(level_names) > 1 else level_names[0]
- new_dtypes = self.index.to_frame(name=names).dtypes
- new_dtypes = pandas... |
codereview_new_python_data_10694 | def from_labels(self) -> "PandasDataframe":
if "index" not in self.columns
else "level_{}".format(0)
]
- names = tuple(level_names) if len(level_names) > 1 else level_names[0]
- new_dtypes = self.index.to_frame(name=names).dtypes
- new_dtypes = pandas... |
codereview_new_python_data_10695 | def test_mean_with_datetime(by_func):
def test_groupby_mad_warn():
- modin_df = pd.DataFrame(test_groupby_data)
md_grp = modin_df.groupby(by=modin_df.columns[0])
msg = "The 'mad' method is deprecated and will be removed in a future version."
- with pytest.warns(FutureWarning, match=msg):
- ... |
codereview_new_python_data_10696 | def values(self): # noqa: RT01, D200
Return Series as ndarray or ndarray-like depending on the dtype.
"""
data = self.to_numpy()
- if isinstance(self.dtype, pandas.CategoricalDtype):
- data = pandas.Categorical(data, dtype=self.dtype)
return data
def add(se... |
codereview_new_python_data_10697 |
import sys
from ipykernel import kernelspec
default_make_ipkernel_cmd = kernelspec.make_ipkernel_cmd
-def new_make_ipkernel_cmd(
mod="ipykernel_launcher", executable=None, extra_arguments=None
):
mpi_arguments = ["mpiexec", "-n", "1"]
arguments = default_make_ipkernel_cmd(mod, executable, extr... |
codereview_new_python_data_10698 |
import sys
from ipykernel import kernelspec
default_make_ipkernel_cmd = kernelspec.make_ipkernel_cmd
-def new_make_ipkernel_cmd(
mod="ipykernel_launcher", executable=None, extra_arguments=None
):
mpi_arguments = ["mpiexec", "-n", "1"]
arguments = default_make_ipkernel_cmd(mod, executable, extr... |
codereview_new_python_data_10699 |
import sys
from ipykernel import kernelspec
default_make_ipkernel_cmd = kernelspec.make_ipkernel_cmd
-def new_make_ipkernel_cmd(
mod="ipykernel_launcher", executable=None, extra_arguments=None
):
mpi_arguments = ["mpiexec", "-n", "1"]
arguments = default_make_ipkernel_cmd(mod, executable, extr... |
codereview_new_python_data_10700 |
import sys
from ipykernel import kernelspec
default_make_ipkernel_cmd = kernelspec.make_ipkernel_cmd
-def new_make_ipkernel_cmd(
mod="ipykernel_launcher", executable=None, extra_arguments=None
):
mpi_arguments = ["mpiexec", "-n", "1"]
arguments = default_make_ipkernel_cmd(mod, executable, extr... |
codereview_new_python_data_10701 |
from nbconvert.preprocessors import ExecutePreprocessor
test_dataset_path = "taxi.csv"
-kernel_name = (
- os.environ["MODIN_KERNEL_NAME"] if "MODIN_KERNEL_NAME" in os.environ else None
-)
-ep = ExecutePreprocessor(
- timeout=600, kernel_name=kernel_name if kernel_name else "python3"
-)
download_taxi_datas... |
codereview_new_python_data_10702 |
_execute_notebook,
test_dataset_path,
download_taxi_dataset,
- change_kernel,
)
# the kernel name "python3mpi" must match the one
# that is set up in `examples/tutorial/jupyter/execution/pandas_on_unidist/setup_kernel.py`
# for `Unidist` engine
-change_kernel(kernel_name="python3mpi")
local_... |
codereview_new_python_data_10703 |
def custom_make_ipkernel_cmd(*args, **kwargs):
"""
- Build modifyied Popen command list for launching an IPython kernel with mpi.
-
Returns
-------
array
- A Popen command list
Notes
-----
```suggestion
Build modified Popen command list for launching an IPython kernel... |
codereview_new_python_data_10704 |
def custom_make_ipkernel_cmd(*args, **kwargs):
"""
- Build modifyied Popen command list for launching an IPython kernel with mpi.
-
Returns
-------
array
- A Popen command list
Notes
-----
```suggestion
Parameters
----------
*args : iterable
Additio... |
codereview_new_python_data_10705 |
_execute_notebook,
test_dataset_path,
download_taxi_dataset,
- change_kernel,
)
# the kernel name "python3mpi" must match the one
# that is set up in `examples/tutorial/jupyter/execution/pandas_on_unidist/setup_kernel.py`
# for `Unidist` engine
-change_kernel(kernel_name="python3mpi")
local_... |
codereview_new_python_data_10706 | def call_progress_bar(result_parts, line_no):
elif modin_engine == "Unidist":
from unidist import wait
else:
- raise RuntimeError(
f"ProgressBar feature is not supported for {modin_engine} engine."
)
We probably need to enable a test for this engine?
def call_progre... |
codereview_new_python_data_10707 |
# ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.
-"""The module for working with displaying progress bars for Modin execution engines."""
import os
import time
@modin-project/modin-core, does anyone remember why the fil... |
codereview_new_python_data_10708 | def check_partition_column(partition_column, cols):
if k == partition_column:
if v == "int":
return
- raise InvalidPartitionColumn(
- "partition_column must be int, and not {0}".format(v)
- )
raise InvalidPartitionColumn(
- "partit... |
codereview_new_python_data_10709 | def test_map(data, na_values):
# Index into list objects
df_equals(
- modin_series_lists.map(lambda list: list[0]),
- pandas_series_lists.map(lambda list: list[0]),
)
```suggestion
modin_series_lists.map(lambda lst: lst[0]),
pandas_series_lists.map(lambda lst: lst[... |
codereview_new_python_data_10710 | def groupby_agg(
how="axis_wise",
drop=False,
):
- # Defaulting to pandas in case of an empty frame
if len(self.columns) == 0 or len(self.index) == 0:
return super().groupby_agg(
by, agg_func, axis, groupby_kwargs, agg_args, agg_kwargs, how, drop
we... |
codereview_new_python_data_10711 | def test_index_of_empty_frame():
md_df, pd_df = create_test_dfs(
{}, index=pandas.Index([], name="index name"), columns=["a", "b"]
)
- assert md_df.empty and md_df.empty
- df_equals(md_df.index, md_df.index)
# Test on an empty frame produced by Modin's logic
data = test_data_values... |
codereview_new_python_data_10712 | def test_index_of_empty_frame():
md_df, pd_df = create_test_dfs(
{}, index=pandas.Index([], name="index name"), columns=["a", "b"]
)
- assert md_df.empty and md_df.empty
- df_equals(md_df.index, md_df.index)
# Test on an empty frame produced by Modin's logic
data = test_data_values... |
codereview_new_python_data_10713 |
from .arr import *
from .math import *
from .constants import *
## 'import *' may pollute namespace
Import pollutes the enclosing namespace, as the imported module [modin.numpy.arr](1) does not define '__all__'.
[Show more details](https://github.com/modin-project/modin/security/code-scanning/470)
+# Licensed ... |
codereview_new_python_data_10714 |
from .arr import *
from .math import *
from .constants import *
## 'import *' may pollute namespace
Import pollutes the enclosing namespace, as the imported module [modin.numpy.math](1) does not define '__all__'.
[Show more details](https://github.com/modin-project/modin/security/code-scanning/471)
+# Licensed... |
codereview_new_python_data_10715 |
from .arr import *
from .math import *
from .constants import *
## 'import *' may pollute namespace
Import pollutes the enclosing namespace, as the imported module [modin.numpy.constants](1) does not define '__all__'.
[Show more details](https://github.com/modin-project/modin/security/code-scanning/472)
+# Lic... |
codereview_new_python_data_10716 | def to_numpy(
Convert the `BasePandasDataset` to a NumPy array.
"""
from modin.config import ExperimentalNumPyAPI
if ExperimentalNumPyAPI.get():
from ..numpy.arr import array
return array(_query_compiler=self._query_compiler, _ndim=2)
-
r... |
codereview_new_python_data_10717 | def to_numpy(
Convert the `BasePandasDataset` to a NumPy array.
"""
from modin.config import ExperimentalNumPyAPI
if ExperimentalNumPyAPI.get():
from ..numpy.arr import array
return array(_query_compiler=self._query_compiler, _ndim=2)
-
r... |
codereview_new_python_data_10718 | def to_numpy(
Return the NumPy ndarray representing the values in this Series or Index.
"""
from modin.config import ExperimentalNumPyAPI
if not ExperimentalNumPyAPI.get():
return (
super(Series, self)
import should be done on top of the file
def to_... |
codereview_new_python_data_10719 | class TestReadFromPostgres(EnvironmentVariable, type=bool):
varname = "MODIN_TEST_READ_FROM_POSTGRES"
default = False
class ExperimentalNumPyAPI(EnvironmentVariable, type=bool):
"""Set to true to use Modin's experimental NumPy API."""
varname = "MODIN_EXPERIMENTAL_NUMPY_API"
default = Fal... |
codereview_new_python_data_10720 |
def where(condition, x=None, y=None):
- if condition:
return x
- if not condition:
return y
if hasattr(condition, "where"):
return condition.where(x=x, y=y)
This seems incorrect, since `where` is supposed to check the `condition` array element-wise. Even if the argument here... |
codereview_new_python_data_10721 |
newaxis,
pi,
)
Do we need to define `__all__` here?
newaxis,
pi,
)
+
+__all__ = [
+ "Inf",
+ "Infinity",
+ "NAN",
+ "NINF",
+ "NZERO",
+ "NaN",
+ "PINF",
+ "PZERO",
+ "e",
+ "euler_gamma",
+ "inf",
+ "infty",
+ "nan",
+ "newaxis",
+ "pi",
+] |
codereview_new_python_data_10722 |
# governing permissions and limitations under the License.
"""Module houses array creation methods for Modin's NumPy API."""
import numpy
from modin.error_message import ErrorMessage
from .arr import array
## Cyclic import
Import of module [modin.numpy.arr](1) begins an import cycle.
[Show more details](ht... |
codereview_new_python_data_10723 |
# governing permissions and limitations under the License.
"""Module houses array shaping methods for Modin's NumPy API."""
import numpy
from modin.error_message import ErrorMessage
## Cyclic import
Import of module [modin.numpy.arr](1) begins an import cycle.
[Show more details](https://github.com/modin-pr... |
codereview_new_python_data_10724 |
# governing permissions and limitations under the License.
"""Module houses array shaping methods for Modin's NumPy API."""
import numpy
from modin.error_message import ErrorMessage
```suggestion
"""Module houses array shaping methods for Modin's NumPy API."""
import numpy
```
# governing permissions ... |
codereview_new_python_data_10725 |
# governing permissions and limitations under the License.
"""Module houses array creation methods for Modin's NumPy API."""
import numpy
from modin.error_message import ErrorMessage
from .arr import array
```suggestion
"""Module houses array creation methods for Modin's NumPy API."""
import numpy
fro... |
codereview_new_python_data_10726 |
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.
"""Module houses ``array`` class, that is distributed version of ``numpy.array``."""
f... |
codereview_new_python_data_10727 | def initialize_ray(
ray_init_kwargs = {
"num_cpus": CpuCount.get(),
"num_gpus": GpuCount.get(),
- "include_dashboard": True,
"ignore_reinit_error": True,
"object_store_memory": object_store_memory,
"_redis_... |
codereview_new_python_data_10728 |
from .partition import PandasOnRayDataframePartition
from .partition_manager import PandasOnRayDataframePartitionManager
-from .virtual_partition import (
- PandasOnRayDataframeVirtualPartition,
- PandasOnRayDataframeColumnPartition,
- PandasOnRayDataframeRowPartition,
-)
__all__ = [
"PandasOnRayD... |
codereview_new_python_data_10729 | def initialize_ray(
ray_init_kwargs = {
"num_cpus": CpuCount.get(),
"num_gpus": GpuCount.get(),
- "include_dashboard": True,
"ignore_reinit_error": True,
"object_store_memory": object_store_memory,
"_redis_... |
codereview_new_python_data_10730 |
# We have to explicitly mock subclass implementations of wait_partitions.
if engine == "Ray":
wait_method = (
- "modin.core.execution.ray.implementations."
- + "pandas_on_ray.partitioning."
+ "PandasOnRayDataframePartitionManager.wait_partitions"
)
elif engine == "Dask":
Let's make... |
codereview_new_python_data_10731 |
if Engine.get() == "Ray":
import ray
- from modin.core.execution.ray.implementations.pandas_on_ray.partitioning import (
PandasOnRayDataframePartition,
)
- from modin.core.execution.ray.implementations.pandas_on_ray.partitioning import (
PandasOnRayDataframeColumnPartition,
... |
codereview_new_python_data_10732 | def fn(
method = kwargs.get("method")
if isinstance(result, pandas.Series):
- result = result.to_frame(method or MODIN_UNNAMED_SERIES_LABEL)
if not as_index:
if isinstance(by, pandas.Series):
this was actually one of those cases where we still... |
codereview_new_python_data_10733 | def fn(
method = kwargs.get("method")
if isinstance(result, pandas.Series):
- result = result.to_frame(method or MODIN_UNNAMED_SERIES_LABEL)
if not as_index:
if isinstance(by, pandas.Series):
So `method` can be used as name for `to_frame`. Is ... |
codereview_new_python_data_10734 |
"TimeReindexMethod",
"TimeFillnaMethodDataframe",
"TimeDropDuplicatesDataframe",
- "TimeSimpleReshape",
"TimeReplace",
# IO benchmarks
"TimeReadCsvSkiprows",
```suggestion
"TimeStack",
"TimeUnstack",
``... |
codereview_new_python_data_10735 | def do_relabel(obj_to_relabel):
agg_kwargs=kwargs,
how="axis_wise",
)
- return result if not do_relabel else do_relabel(result)
agg = aggregate
```suggestion
return do_relabel(result) if do_relabel else result
```
positive conditions are read easier
def ... |
codereview_new_python_data_10736 | class FactoryDispatcher(object):
@classmethod
def get_factory(cls) -> factories.BaseFactory:
"""Get current factory."""
- Engine.subscribe(cls._update_factory)
- StorageFormat.subscribe(cls._update_factory)
return cls.__factory
@classmethod
Formerly, these were in glob... |
codereview_new_python_data_10737 | class FactoryDispatcher(object):
@classmethod
def get_factory(cls) -> factories.BaseFactory:
"""Get current factory."""
- Engine.subscribe(cls._update_factory)
- StorageFormat.subscribe(cls._update_factory)
return cls.__factory
@classmethod
This would subscribe multipl... |
codereview_new_python_data_10738 | def time_timedelta_nanoseconds(self, shape):
execute(self.series.dt.nanoseconds)
-class TimeSetCategories:
-
- params = [get_benchmark_shapes("TimeSetCategories")]
- param_names = ["shape"]
-
def setup(self, shape):
rows = shape[0]
arr = [f"s{i:04d}" for i in np.random.randint... |
codereview_new_python_data_10739 | def time_timedelta_nanoseconds(self, shape):
execute(self.series.dt.nanoseconds)
-class TimeSetCategories:
-
- params = [get_benchmark_shapes("TimeSetCategories")]
- param_names = ["shape"]
-
def setup(self, shape):
rows = shape[0]
arr = [f"s{i:04d}" for i in np.random.randint... |
codereview_new_python_data_10740 | def time_timedelta_nanoseconds(self, shape):
execute(self.series.dt.nanoseconds)
-class TimeSetCategories:
-
- params = [get_benchmark_shapes("TimeSetCategories")]
- param_names = ["shape"]
-
def setup(self, shape):
rows = shape[0]
arr = [f"s{i:04d}" for i in np.random.randint... |
codereview_new_python_data_10741 | def _repartition(self, axis: Optional[int] = None):
DataFrame or Series
The repartitioned dataframe or series, depending on the original type.
"""
- if axis not in (0, 1, None):
- raise NotImplementedError
if StorageFormat.get() == "Hdk":
# Hdk u... |
codereview_new_python_data_10742 | def _repartition(self, axis: Optional[int] = None):
Parameters
----------
- axis : int, optional
Returns
-------
```suggestion
axis : {0, 1}, optional
```
def _repartition(self, axis: Optional[int] = None):
Parameters
----------
+ a... |
codereview_new_python_data_10743 | def get_indices(cls, axis, partitions, index_func=None):
new_idx = [idx.apply(func) for idx in target[0]] if len(target) else []
new_idx = cls.get_objects_from_partitions(new_idx)
# filter empty indexes
- new_idx = list(filter(lambda idx: len(idx), new_idx))
- # TODO FIX INFORM... |
codereview_new_python_data_10744 | class TimeDropDuplicatesDataframe:
param_names = ["shape"]
def setup(self, shape):
- N = shape[0] // 10
K = 10
- key1 = tm.makeStringIndex(N).values.repeat(K)
- key2 = tm.makeStringIndex(N).values.repeat(K)
- self.df = IMPL.DataFrame(
- {"key1": key1, "key2":... |
codereview_new_python_data_10745 | def setup(self, shape):
execute(self.df)
def time_drop_dups(self, shape):
- execute(self.df.drop_duplicates(["key1", "key2"]))
def time_drop_dups_inplace(self, shape):
- self.df.drop_duplicates(["key1", "key2"], inplace=True)
execute(self.df)
Let's perform the operati... |
codereview_new_python_data_10746 | def setup(self, shape):
execute(self.df)
def time_drop_dups(self, shape):
- execute(self.df.drop_duplicates(["key1", "key2"]))
def time_drop_dups_inplace(self, shape):
- self.df.drop_duplicates(["key1", "key2"], inplace=True)
execute(self.df)
Same
```suggestion
... |
codereview_new_python_data_10747 | def _wrap_aggregation(
DataFrame or Series
Returns the same type as `self._df`.
"""
- if not isinstance(numeric_only, NumericOnly):
- numeric_only = NumericOnly(numeric_only)
agg_args = tuple() if agg_args is None else agg_args
agg_kwargs = dict() if... |
codereview_new_python_data_10748 | class BasePandasDataset(ClassLogger):
# but lives in "pandas" namespace.
_pandas_class = pandas.core.generic.NDFrame
- # TODO(https://github.com/modin-project/modin/issues/4821):
- # make this cache_readonly
- @property
def _is_dataframe(self) -> bool:
"""
Tell whether this ... |
codereview_new_python_data_10749 | def broadcast_item(
index_values = obj.index[row_lookup]
if not index_values.equals(item.index):
axes_to_reindex["index"] = index_values
- if need_columns_reindex and isinstance(item, (pandas.DataFrame, DataFrame)):
column_values = obj.columns[col_lookup]
... |
codereview_new_python_data_10750 | def new_col_adder(df, partition_id):
NotImplementedError,
match="Dynamic repartitioning is currently only supported for DataFrames with 1 partition.",
):
- _ = pipeline.compute_batch()
def test_fan_out(self):
"""Check that the fan_out argument is appropriat... |
codereview_new_python_data_10751 | def test_astype(data):
"data", [["A", "A", "B", "B", "A"], [1, 1, 2, 1, 2, 2, 3, 1, 2, 1, 2]]
)
def test_astype_categorical(data):
- modin_df, pandas_df = pd.Series(data), pandas.Series(data)
modin_result = modin_df.astype("category")
pandas_result = pandas_df.astype("category")
```suggestion
... |
codereview_new_python_data_10752 | def initialize_ray(
What password to use when connecting to Redis.
If not specified, ``modin.config.RayRedisPassword`` is used.
"""
extra_init_kw = {"runtime_env": {"env_vars": {"__MODIN_AUTOIMPORT_PANDAS__": "1"}}}
if not ray.is_initialized() or override_is_cluster:
- # TODO(ht... |
codereview_new_python_data_10753 | def execute(
return
partitions = df._query_compiler._modin_frame._partitions.flatten()
if len(partitions) > 0 and hasattr(partitions[0], "wait"):
- all(map(lambda partition: partition.wait() or True, partitions))
return
# compatibility with old Modin ve... |
codereview_new_python_data_10754 | def execute(
df._query_compiler._modin_frame._execute()
return
partitions = df._query_compiler._modin_frame._partitions.flatten()
- if len(partitions) > 0 and hasattr(partitions[0], "wait"):
- df._query_compiler._modin_frame._partition_mgr_cls.wait_partitions(
- ... |
codereview_new_python_data_10755 | def test_dict(self):
assert mdt == "category"
assert isinstance(mdt, pandas.CategoricalDtype)
assert pandas.api.types.is_categorical_dtype(mdt)
if type(mdt) != pandas.CategoricalDtype:
# This is a lazy proxy.
- # Make sure the table is not materialized afte... |
codereview_new_python_data_10756 | def test_dict(self):
assert pandas.api.types.is_categorical_dtype(mdt)
assert str(mdt) == str(pdt)
- if type(mdt) != pandas.CategoricalDtype:
- # This is a lazy proxy.
- # Make sure the table is not materialized yet.
- assert mdt._table is not None
... |
codereview_new_python_data_10757 |
# ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.
-"""Utilities for internal use by te hdk_on_native module."""
import pandas
```suggestion
"""Utilities for internal use by the ``HdkOnNativeDataframe``."""
```
# AN... |
codereview_new_python_data_10758 | def ml(train_final, test_final):
evals=watchlist,
feval=func_loss,
early_stopping_rounds=10,
- verbose_eval=1000,
)
yp = clf.predict(dvalid)
```suggestion
verbose_eval=None,
```
Decided to leave as is to not issue a lot of warnings which might be kind of confus... |
codereview_new_python_data_10759 | def ml(train_final, test_final):
evals=watchlist,
feval=func_loss,
early_stopping_rounds=10,
- verbose_eval=1000,
)
yp = clf.predict(dvalid)
```suggestion
verbose_eval=None,
```
Decided to leave as is to not issue a lot of warnings which might be kind of confus... |
codereview_new_python_data_10760 | def test_info(data, verbose, max_cols, memory_usage, null_counts):
assert modin_info[1:] == pandas_info[1:]
-def test_info_default_cols():
- # Covers https://github.com/modin-project/modin/issues/5137
- with io.StringIO() as first, io.StringIO() as second:
- data = np.random.randint(0, 100, (... |
codereview_new_python_data_10761 | def test_add_does_not_change_original_series_name():
s2 = pd.Series(2, name=2)
original_s1 = s1.copy(deep=True)
original_s2 = s2.copy(deep=True)
- s1 + s2
df_equals(s1, original_s1)
df_equals(s2, original_s2)
## Statement has no effect
This statement has no effect.
[Show more details](... |
codereview_new_python_data_10762 | def test_add_does_not_change_original_series_name():
s2 = pd.Series(2, name=2)
original_s1 = s1.copy(deep=True)
original_s2 = s2.copy(deep=True)
- s1 + s2
df_equals(s1, original_s1)
df_equals(s2, original_s2)
Maybe make the change to disable CodeQL warning?
```suggestion
_ = s1 + s... |
codereview_new_python_data_10763 | def test_add_does_not_change_original_series_name():
s2 = pd.Series(2, name=2)
original_s1 = s1.copy(deep=True)
original_s2 = s2.copy(deep=True)
- s1 + s2
df_equals(s1, original_s1)
df_equals(s2, original_s2)
why not do something like `s1.add(s2)` or something l like that?
def test_add... |
codereview_new_python_data_10764 | def test_add_custom_class():
)
def test_non_commutative_multiply():
# This test checks that mul and rmul do different things when
# multiplication is not commutative, e.g. for adding a string to a string.
# For context see https://github.com/modin-project/modin/issues/5238
modin_df, panda... |
codereview_new_python_data_10765 | def test_non_commutative_add_string_to_series(data):
eval_general(*create_test_series(data), lambda s: s + "string")
def test_non_commutative_multiply():
# This test checks that mul and rmul do different things when
# multiplication is not commutative, e.g. for adding a string to a string.
# F... |
codereview_new_python_data_10766 | def compare(self, other, **kwargs):
return self.__constructor__(
self._modin_frame.broadcast_apply_full_axis(
0,
- lambda l, r: pandas.DataFrame.compare(l, r, **kwargs),
other._modin_frame,
)
)
```suggestion
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.