repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
modin-project/modin | ci/benchmarks/utils.py | time_logger | def time_logger(name):
"""This logs the time usage of a code block"""
start_time = time.time()
yield
end_time = time.time()
total_time = end_time - start_time
logging.info("%s; time: %ss", name, total_time) | python | def time_logger(name):
"""This logs the time usage of a code block"""
start_time = time.time()
yield
end_time = time.time()
total_time = end_time - start_time
logging.info("%s; time: %ss", name, total_time) | [
"def",
"time_logger",
"(",
"name",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"yield",
"end_time",
"=",
"time",
".",
"time",
"(",
")",
"total_time",
"=",
"end_time",
"-",
"start_time",
"logging",
".",
"info",
"(",
"\"%s; time: %ss\"",
",... | This logs the time usage of a code block | [
"This",
"logs",
"the",
"time",
"usage",
"of",
"a",
"code",
"block"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/ci/benchmarks/utils.py#L12-L19 | train |
modin-project/modin | modin/pandas/__init__.py | initialize_ray | def initialize_ray():
"""Initializes ray based on environment variables and internal defaults."""
if threading.current_thread().name == "MainThread":
plasma_directory = None
object_store_memory = os.environ.get("MODIN_MEMORY", None)
if os.environ.get("MODIN_OUT_OF_CORE", "False").title()... | python | def initialize_ray():
"""Initializes ray based on environment variables and internal defaults."""
if threading.current_thread().name == "MainThread":
plasma_directory = None
object_store_memory = os.environ.get("MODIN_MEMORY", None)
if os.environ.get("MODIN_OUT_OF_CORE", "False").title()... | [
"def",
"initialize_ray",
"(",
")",
":",
"if",
"threading",
".",
"current_thread",
"(",
")",
".",
"name",
"==",
"\"MainThread\"",
":",
"plasma_directory",
"=",
"None",
"object_store_memory",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"\"MODIN_MEMORY\"",
",",
... | Initializes ray based on environment variables and internal defaults. | [
"Initializes",
"ray",
"based",
"on",
"environment",
"variables",
"and",
"internal",
"defaults",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/__init__.py#L133-L168 | train |
modin-project/modin | modin/engines/dask/pandas_on_dask_delayed/frame/axis_partition.py | DaskFrameAxisPartition.apply | def apply(
self,
func,
num_splits=None,
other_axis_partition=None,
maintain_partitioning=True,
**kwargs
):
"""Applies func to the object.
See notes in Parent class about this method.
Args:
func: The function to apply.
... | python | def apply(
self,
func,
num_splits=None,
other_axis_partition=None,
maintain_partitioning=True,
**kwargs
):
"""Applies func to the object.
See notes in Parent class about this method.
Args:
func: The function to apply.
... | [
"def",
"apply",
"(",
"self",
",",
"func",
",",
"num_splits",
"=",
"None",
",",
"other_axis_partition",
"=",
"None",
",",
"maintain_partitioning",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"dask",
"if",
"num_splits",
"is",
"None",
":",
"nu... | Applies func to the object.
See notes in Parent class about this method.
Args:
func: The function to apply.
num_splits: The number of times to split the result object.
other_axis_partition: Another `DaskFrameAxisPartition` object to apply to
func wit... | [
"Applies",
"func",
"to",
"the",
"object",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/dask/pandas_on_dask_delayed/frame/axis_partition.py#L15-L63 | train |
modin-project/modin | modin/pandas/reshape.py | get_dummies | def get_dummies(
data,
prefix=None,
prefix_sep="_",
dummy_na=False,
columns=None,
sparse=False,
drop_first=False,
dtype=None,
):
"""Convert categorical variable into indicator variables.
Args:
data (array-like, Series, or DataFrame): data to encode.
prefix (strin... | python | def get_dummies(
data,
prefix=None,
prefix_sep="_",
dummy_na=False,
columns=None,
sparse=False,
drop_first=False,
dtype=None,
):
"""Convert categorical variable into indicator variables.
Args:
data (array-like, Series, or DataFrame): data to encode.
prefix (strin... | [
"def",
"get_dummies",
"(",
"data",
",",
"prefix",
"=",
"None",
",",
"prefix_sep",
"=",
"\"_\"",
",",
"dummy_na",
"=",
"False",
",",
"columns",
"=",
"None",
",",
"sparse",
"=",
"False",
",",
"drop_first",
"=",
"False",
",",
"dtype",
"=",
"None",
",",
... | Convert categorical variable into indicator variables.
Args:
data (array-like, Series, or DataFrame): data to encode.
prefix (string, [string]): Prefix to apply to each encoded column
label.
prefix_sep (string, [string]): Separator between prefix and value... | [
"Convert",
"categorical",
"variable",
"into",
"indicator",
"variables",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/reshape.py#L12-L67 | train |
modin-project/modin | modin/engines/base/frame/axis_partition.py | PandasFrameAxisPartition.apply | def apply(
self,
func,
num_splits=None,
other_axis_partition=None,
maintain_partitioning=True,
**kwargs
):
"""Applies func to the object in the plasma store.
See notes in Parent class about this method.
Args:
func: The function to... | python | def apply(
self,
func,
num_splits=None,
other_axis_partition=None,
maintain_partitioning=True,
**kwargs
):
"""Applies func to the object in the plasma store.
See notes in Parent class about this method.
Args:
func: The function to... | [
"def",
"apply",
"(",
"self",
",",
"func",
",",
"num_splits",
"=",
"None",
",",
"other_axis_partition",
"=",
"None",
",",
"maintain_partitioning",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"num_splits",
"is",
"None",
":",
"num_splits",
"=",
"l... | Applies func to the object in the plasma store.
See notes in Parent class about this method.
Args:
func: The function to apply.
num_splits: The number of times to split the result object.
other_axis_partition: Another `PandasOnRayFrameAxisPartition` object to apply ... | [
"Applies",
"func",
"to",
"the",
"object",
"in",
"the",
"plasma",
"store",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/axis_partition.py#L98-L141 | train |
modin-project/modin | modin/engines/base/frame/axis_partition.py | PandasFrameAxisPartition.shuffle | def shuffle(self, func, lengths, **kwargs):
"""Shuffle the order of the data in this axis based on the `lengths`.
Extends `BaseFrameAxisPartition.shuffle`.
Args:
func: The function to apply before splitting.
lengths: The list of partition lengths to split the result int... | python | def shuffle(self, func, lengths, **kwargs):
"""Shuffle the order of the data in this axis based on the `lengths`.
Extends `BaseFrameAxisPartition.shuffle`.
Args:
func: The function to apply before splitting.
lengths: The list of partition lengths to split the result int... | [
"def",
"shuffle",
"(",
"self",
",",
"func",
",",
"lengths",
",",
"*",
"*",
"kwargs",
")",
":",
"num_splits",
"=",
"len",
"(",
"lengths",
")",
"# We add these to kwargs and will pop them off before performing the operation.",
"kwargs",
"[",
"\"manual_partition\"",
"]",... | Shuffle the order of the data in this axis based on the `lengths`.
Extends `BaseFrameAxisPartition.shuffle`.
Args:
func: The function to apply before splitting.
lengths: The list of partition lengths to split the result into.
Returns:
A list of RemotePartit... | [
"Shuffle",
"the",
"order",
"of",
"the",
"data",
"in",
"this",
"axis",
"based",
"on",
"the",
"lengths",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/axis_partition.py#L143-L161 | train |
modin-project/modin | modin/engines/base/frame/axis_partition.py | PandasFrameAxisPartition.deploy_axis_func | def deploy_axis_func(
cls, axis, func, num_splits, kwargs, maintain_partitioning, *partitions
):
"""Deploy a function along a full axis in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
num_splits: ... | python | def deploy_axis_func(
cls, axis, func, num_splits, kwargs, maintain_partitioning, *partitions
):
"""Deploy a function along a full axis in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
num_splits: ... | [
"def",
"deploy_axis_func",
"(",
"cls",
",",
"axis",
",",
"func",
",",
"num_splits",
",",
"kwargs",
",",
"maintain_partitioning",
",",
"*",
"partitions",
")",
":",
"# Pop these off first because they aren't expected by the function.",
"manual_partition",
"=",
"kwargs",
"... | Deploy a function along a full axis in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
num_splits: The number of splits to return
(see `split_result_of_axis_func_pandas`)
kwargs: A di... | [
"Deploy",
"a",
"function",
"along",
"a",
"full",
"axis",
"in",
"Ray",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/axis_partition.py#L164-L210 | train |
modin-project/modin | modin/engines/base/frame/axis_partition.py | PandasFrameAxisPartition.deploy_func_between_two_axis_partitions | def deploy_func_between_two_axis_partitions(
cls, axis, func, num_splits, len_of_left, kwargs, *partitions
):
"""Deploy a function along a full axis between two data sets in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
... | python | def deploy_func_between_two_axis_partitions(
cls, axis, func, num_splits, len_of_left, kwargs, *partitions
):
"""Deploy a function along a full axis between two data sets in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
... | [
"def",
"deploy_func_between_two_axis_partitions",
"(",
"cls",
",",
"axis",
",",
"func",
",",
"num_splits",
",",
"len_of_left",
",",
"kwargs",
",",
"*",
"partitions",
")",
":",
"lt_frame",
"=",
"pandas",
".",
"concat",
"(",
"list",
"(",
"partitions",
"[",
":"... | Deploy a function along a full axis between two data sets in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
num_splits: The number of splits to return
(see `split_result_of_axis_func_pandas`).
len_of_left: ... | [
"Deploy",
"a",
"function",
"along",
"a",
"full",
"axis",
"between",
"two",
"data",
"sets",
"in",
"Ray",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/axis_partition.py#L213-L236 | train |
modin-project/modin | modin/backends/pyarrow/query_compiler.py | PyarrowQueryCompiler.query | def query(self, expr, **kwargs):
"""Query columns of the DataManager with a boolean expression.
Args:
expr: Boolean expression to query the columns with.
Returns:
DataManager containing the rows where the boolean expression is satisfied.
"""
d... | python | def query(self, expr, **kwargs):
"""Query columns of the DataManager with a boolean expression.
Args:
expr: Boolean expression to query the columns with.
Returns:
DataManager containing the rows where the boolean expression is satisfied.
"""
d... | [
"def",
"query",
"(",
"self",
",",
"expr",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"gen_table_expr",
"(",
"table",
",",
"expr",
")",
":",
"resolver",
"=",
"{",
"name",
":",
"FakeSeries",
"(",
"dtype",
".",
"to_pandas_dtype",
"(",
")",
")",
"for",
... | Query columns of the DataManager with a boolean expression.
Args:
expr: Boolean expression to query the columns with.
Returns:
DataManager containing the rows where the boolean expression is satisfied. | [
"Query",
"columns",
"of",
"the",
"DataManager",
"with",
"a",
"boolean",
"expression",
".",
"Args",
":",
"expr",
":",
"Boolean",
"expression",
"to",
"query",
"the",
"columns",
"with",
".",
"Returns",
":",
"DataManager",
"containing",
"the",
"rows",
"where",
"... | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pyarrow/query_compiler.py#L17-L153 | train |
modin-project/modin | modin/backends/pyarrow/query_compiler.py | PyarrowQueryCompiler.to_pandas | def to_pandas(self):
"""Converts Modin DataFrame to Pandas DataFrame.
Returns:
Pandas DataFrame of the DataManager.
"""
df = self.data.to_pandas(is_transposed=self._is_transposed)
if df.empty:
dtype_dict = {
col_name: pandas.Serie... | python | def to_pandas(self):
"""Converts Modin DataFrame to Pandas DataFrame.
Returns:
Pandas DataFrame of the DataManager.
"""
df = self.data.to_pandas(is_transposed=self._is_transposed)
if df.empty:
dtype_dict = {
col_name: pandas.Serie... | [
"def",
"to_pandas",
"(",
"self",
")",
":",
"df",
"=",
"self",
".",
"data",
".",
"to_pandas",
"(",
"is_transposed",
"=",
"self",
".",
"_is_transposed",
")",
"if",
"df",
".",
"empty",
":",
"dtype_dict",
"=",
"{",
"col_name",
":",
"pandas",
".",
"Series",... | Converts Modin DataFrame to Pandas DataFrame.
Returns:
Pandas DataFrame of the DataManager. | [
"Converts",
"Modin",
"DataFrame",
"to",
"Pandas",
"DataFrame",
".",
"Returns",
":",
"Pandas",
"DataFrame",
"of",
"the",
"DataManager",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pyarrow/query_compiler.py#L174-L193 | train |
modin-project/modin | modin/experimental/engines/pyarrow_on_ray/frame/axis_partition.py | deploy_ray_axis_func | def deploy_ray_axis_func(axis, func, num_splits, kwargs, *partitions):
"""Deploy a function along a full axis in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
num_splits: The number of splits to return
(see `split_result_of_axis_func... | python | def deploy_ray_axis_func(axis, func, num_splits, kwargs, *partitions):
"""Deploy a function along a full axis in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
num_splits: The number of splits to return
(see `split_result_of_axis_func... | [
"def",
"deploy_ray_axis_func",
"(",
"axis",
",",
"func",
",",
"num_splits",
",",
"kwargs",
",",
"*",
"partitions",
")",
":",
"table",
"=",
"concat_arrow_table_partitions",
"(",
"axis",
",",
"partitions",
")",
"try",
":",
"result",
"=",
"func",
"(",
"table",
... | Deploy a function along a full axis in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
num_splits: The number of splits to return
(see `split_result_of_axis_func_pandas`)
kwargs: A dictionary of keyword arguments.
partition... | [
"Deploy",
"a",
"function",
"along",
"a",
"full",
"axis",
"in",
"Ray",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pyarrow_on_ray/frame/axis_partition.py#L140-L161 | train |
modin-project/modin | modin/experimental/engines/pyarrow_on_ray/frame/axis_partition.py | deploy_ray_func_between_two_axis_partitions | def deploy_ray_func_between_two_axis_partitions(
axis, func, num_splits, len_of_left, kwargs, *partitions
):
"""Deploy a function along a full axis between two data sets in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
num_splits: The number... | python | def deploy_ray_func_between_two_axis_partitions(
axis, func, num_splits, len_of_left, kwargs, *partitions
):
"""Deploy a function along a full axis between two data sets in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
num_splits: The number... | [
"def",
"deploy_ray_func_between_two_axis_partitions",
"(",
"axis",
",",
"func",
",",
"num_splits",
",",
"len_of_left",
",",
"kwargs",
",",
"*",
"partitions",
")",
":",
"lt_table",
"=",
"concat_arrow_table_partitions",
"(",
"axis",
",",
"partitions",
"[",
":",
"len... | Deploy a function along a full axis between two data sets in Ray.
Args:
axis: The axis to perform the function along.
func: The function to perform.
num_splits: The number of splits to return
(see `split_result_of_axis_func_pandas`).
len_of_left: The number of values in ... | [
"Deploy",
"a",
"function",
"along",
"a",
"full",
"axis",
"between",
"two",
"data",
"sets",
"in",
"Ray",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pyarrow_on_ray/frame/axis_partition.py#L165-L194 | train |
modin-project/modin | modin/experimental/engines/pyarrow_on_ray/frame/axis_partition.py | PyarrowOnRayFrameAxisPartition.apply | def apply(self, func, num_splits=None, other_axis_partition=None, **kwargs):
"""Applies func to the object in the plasma store.
See notes in Parent class about this method.
Args:
func: The function to apply.
num_splits: The number of times to split the result object.
... | python | def apply(self, func, num_splits=None, other_axis_partition=None, **kwargs):
"""Applies func to the object in the plasma store.
See notes in Parent class about this method.
Args:
func: The function to apply.
num_splits: The number of times to split the result object.
... | [
"def",
"apply",
"(",
"self",
",",
"func",
",",
"num_splits",
"=",
"None",
",",
"other_axis_partition",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"num_splits",
"is",
"None",
":",
"num_splits",
"=",
"len",
"(",
"self",
".",
"list_of_blocks",
... | Applies func to the object in the plasma store.
See notes in Parent class about this method.
Args:
func: The function to apply.
num_splits: The number of times to split the result object.
other_axis_partition: Another `PyarrowOnRayFrameAxisPartition` object to apply... | [
"Applies",
"func",
"to",
"the",
"object",
"in",
"the",
"plasma",
"store",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pyarrow_on_ray/frame/axis_partition.py#L16-L48 | train |
modin-project/modin | modin/experimental/engines/pyarrow_on_ray/frame/axis_partition.py | PyarrowOnRayFrameAxisPartition.shuffle | def shuffle(self, func, num_splits=None, **kwargs):
"""Shuffle the order of the data in this axis based on the `func`.
Extends `BaseFrameAxisPartition.shuffle`.
:param func:
:param num_splits:
:param kwargs:
:return:
"""
if num_splits is None:
... | python | def shuffle(self, func, num_splits=None, **kwargs):
"""Shuffle the order of the data in this axis based on the `func`.
Extends `BaseFrameAxisPartition.shuffle`.
:param func:
:param num_splits:
:param kwargs:
:return:
"""
if num_splits is None:
... | [
"def",
"shuffle",
"(",
"self",
",",
"func",
",",
"num_splits",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"num_splits",
"is",
"None",
":",
"num_splits",
"=",
"len",
"(",
"self",
".",
"list_of_blocks",
")",
"args",
"=",
"[",
"self",
".",
... | Shuffle the order of the data in this axis based on the `func`.
Extends `BaseFrameAxisPartition.shuffle`.
:param func:
:param num_splits:
:param kwargs:
:return: | [
"Shuffle",
"the",
"order",
"of",
"the",
"data",
"in",
"this",
"axis",
"based",
"on",
"the",
"func",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pyarrow_on_ray/frame/axis_partition.py#L50-L68 | train |
modin-project/modin | modin/experimental/engines/pyarrow_on_ray/frame/partition.py | deploy_ray_func | def deploy_ray_func(func, partition, kwargs):
"""Deploy a function to a partition in Ray.
Args:
func: The function to apply.
partition: The partition to apply the function to.
kwargs: A dictionary of keyword arguments for the function.
Returns:
The result of the function.
... | python | def deploy_ray_func(func, partition, kwargs):
"""Deploy a function to a partition in Ray.
Args:
func: The function to apply.
partition: The partition to apply the function to.
kwargs: A dictionary of keyword arguments for the function.
Returns:
The result of the function.
... | [
"def",
"deploy_ray_func",
"(",
"func",
",",
"partition",
",",
"kwargs",
")",
":",
"try",
":",
"result",
"=",
"func",
"(",
"partition",
",",
"*",
"*",
"kwargs",
")",
"# Sometimes Arrow forces us to make a copy of an object before we operate",
"# on it. We don't want the ... | Deploy a function to a partition in Ray.
Args:
func: The function to apply.
partition: The partition to apply the function to.
kwargs: A dictionary of keyword arguments for the function.
Returns:
The result of the function. | [
"Deploy",
"a",
"function",
"to",
"a",
"partition",
"in",
"Ray",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pyarrow_on_ray/frame/partition.py#L120-L142 | train |
modin-project/modin | modin/experimental/engines/pyarrow_on_ray/frame/partition.py | PyarrowOnRayFramePartition.get | def get(self):
"""Gets the object out of the plasma store.
Returns:
The object from the plasma store.
"""
if len(self.call_queue):
return self.apply(lambda x: x).get()
return ray.get(self.oid) | python | def get(self):
"""Gets the object out of the plasma store.
Returns:
The object from the plasma store.
"""
if len(self.call_queue):
return self.apply(lambda x: x).get()
return ray.get(self.oid) | [
"def",
"get",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"call_queue",
")",
":",
"return",
"self",
".",
"apply",
"(",
"lambda",
"x",
":",
"x",
")",
".",
"get",
"(",
")",
"return",
"ray",
".",
"get",
"(",
"self",
".",
"oid",
")"
] | Gets the object out of the plasma store.
Returns:
The object from the plasma store. | [
"Gets",
"the",
"object",
"out",
"of",
"the",
"plasma",
"store",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pyarrow_on_ray/frame/partition.py#L19-L28 | train |
modin-project/modin | modin/experimental/engines/pyarrow_on_ray/frame/partition.py | PyarrowOnRayFramePartition.apply | def apply(self, func, **kwargs):
"""Apply a function to the object stored in this partition.
Note: It does not matter if func is callable or an ObjectID. Ray will
handle it correctly either way. The keyword arguments are sent as a
dictionary.
Args:
func: The... | python | def apply(self, func, **kwargs):
"""Apply a function to the object stored in this partition.
Note: It does not matter if func is callable or an ObjectID. Ray will
handle it correctly either way. The keyword arguments are sent as a
dictionary.
Args:
func: The... | [
"def",
"apply",
"(",
"self",
",",
"func",
",",
"*",
"*",
"kwargs",
")",
":",
"oid",
"=",
"self",
".",
"oid",
"self",
".",
"call_queue",
".",
"append",
"(",
"(",
"func",
",",
"kwargs",
")",
")",
"def",
"call_queue_closure",
"(",
"oid_obj",
",",
"cal... | Apply a function to the object stored in this partition.
Note: It does not matter if func is callable or an ObjectID. Ray will
handle it correctly either way. The keyword arguments are sent as a
dictionary.
Args:
func: The function to apply.
Returns:
... | [
"Apply",
"a",
"function",
"to",
"the",
"object",
"stored",
"in",
"this",
"partition",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pyarrow_on_ray/frame/partition.py#L30-L62 | train |
modin-project/modin | modin/experimental/engines/pyarrow_on_ray/frame/partition.py | PyarrowOnRayFramePartition.to_pandas | def to_pandas(self):
"""Convert the object stored in this partition to a Pandas DataFrame.
Returns:
A Pandas DataFrame.
"""
dataframe = self.get().to_pandas()
assert type(dataframe) is pandas.DataFrame or type(dataframe) is pandas.Series
return dataframe | python | def to_pandas(self):
"""Convert the object stored in this partition to a Pandas DataFrame.
Returns:
A Pandas DataFrame.
"""
dataframe = self.get().to_pandas()
assert type(dataframe) is pandas.DataFrame or type(dataframe) is pandas.Series
return dataframe | [
"def",
"to_pandas",
"(",
"self",
")",
":",
"dataframe",
"=",
"self",
".",
"get",
"(",
")",
".",
"to_pandas",
"(",
")",
"assert",
"type",
"(",
"dataframe",
")",
"is",
"pandas",
".",
"DataFrame",
"or",
"type",
"(",
"dataframe",
")",
"is",
"pandas",
"."... | Convert the object stored in this partition to a Pandas DataFrame.
Returns:
A Pandas DataFrame. | [
"Convert",
"the",
"object",
"stored",
"in",
"this",
"partition",
"to",
"a",
"Pandas",
"DataFrame",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pyarrow_on_ray/frame/partition.py#L71-L80 | train |
modin-project/modin | modin/experimental/engines/pyarrow_on_ray/frame/partition.py | PyarrowOnRayFramePartition.put | def put(cls, obj):
"""Put an object in the Plasma store and wrap it in this object.
Args:
obj: The object to be put.
Returns:
A `RayRemotePartition` object.
"""
return PyarrowOnRayFramePartition(ray.put(pyarrow.Table.from_pandas(obj))) | python | def put(cls, obj):
"""Put an object in the Plasma store and wrap it in this object.
Args:
obj: The object to be put.
Returns:
A `RayRemotePartition` object.
"""
return PyarrowOnRayFramePartition(ray.put(pyarrow.Table.from_pandas(obj))) | [
"def",
"put",
"(",
"cls",
",",
"obj",
")",
":",
"return",
"PyarrowOnRayFramePartition",
"(",
"ray",
".",
"put",
"(",
"pyarrow",
".",
"Table",
".",
"from_pandas",
"(",
"obj",
")",
")",
")"
] | Put an object in the Plasma store and wrap it in this object.
Args:
obj: The object to be put.
Returns:
A `RayRemotePartition` object. | [
"Put",
"an",
"object",
"in",
"the",
"Plasma",
"store",
"and",
"wrap",
"it",
"in",
"this",
"object",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pyarrow_on_ray/frame/partition.py#L83-L92 | train |
modin-project/modin | modin/pandas/general.py | isna | def isna(obj):
"""
Detect missing values for an array-like object.
Args:
obj: Object to check for null or missing values.
Returns:
bool or array-like of bool
"""
if isinstance(obj, BasePandasDataset):
return obj.isna()
else:
return pandas.isna(obj) | python | def isna(obj):
"""
Detect missing values for an array-like object.
Args:
obj: Object to check for null or missing values.
Returns:
bool or array-like of bool
"""
if isinstance(obj, BasePandasDataset):
return obj.isna()
else:
return pandas.isna(obj) | [
"def",
"isna",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"BasePandasDataset",
")",
":",
"return",
"obj",
".",
"isna",
"(",
")",
"else",
":",
"return",
"pandas",
".",
"isna",
"(",
"obj",
")"
] | Detect missing values for an array-like object.
Args:
obj: Object to check for null or missing values.
Returns:
bool or array-like of bool | [
"Detect",
"missing",
"values",
"for",
"an",
"array",
"-",
"like",
"object",
".",
"Args",
":",
"obj",
":",
"Object",
"to",
"check",
"for",
"null",
"or",
"missing",
"values",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/general.py#L13-L25 | train |
modin-project/modin | modin/pandas/general.py | merge | def merge(
left,
right,
how="inner",
on=None,
left_on=None,
right_on=None,
left_index=False,
right_index=False,
sort=False,
suffixes=("_x", "_y"),
copy=True,
indicator=False,
validate=None,
):
"""Database style join, where common columns in "on" are merged.
A... | python | def merge(
left,
right,
how="inner",
on=None,
left_on=None,
right_on=None,
left_index=False,
right_index=False,
sort=False,
suffixes=("_x", "_y"),
copy=True,
indicator=False,
validate=None,
):
"""Database style join, where common columns in "on" are merged.
A... | [
"def",
"merge",
"(",
"left",
",",
"right",
",",
"how",
"=",
"\"inner\"",
",",
"on",
"=",
"None",
",",
"left_on",
"=",
"None",
",",
"right_on",
"=",
"None",
",",
"left_index",
"=",
"False",
",",
"right_index",
"=",
"False",
",",
"sort",
"=",
"False",
... | Database style join, where common columns in "on" are merged.
Args:
left: DataFrame.
right: DataFrame.
how: What type of join to use.
on: The common column name(s) to join on. If None, and left_on and
right_on are also None, will default to all commonly named
... | [
"Database",
"style",
"join",
"where",
"common",
"columns",
"in",
"on",
"are",
"merged",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/general.py#L41-L97 | train |
modin-project/modin | modin/experimental/engines/pandas_on_ray/sql.py | is_distributed | def is_distributed(partition_column, lower_bound, upper_bound):
""" Check if is possible distribute a query given that args
Args:
partition_column: column used to share the data between the workers
lower_bound: the minimum value to be requested from the partition_column
upper_bound: the... | python | def is_distributed(partition_column, lower_bound, upper_bound):
""" Check if is possible distribute a query given that args
Args:
partition_column: column used to share the data between the workers
lower_bound: the minimum value to be requested from the partition_column
upper_bound: the... | [
"def",
"is_distributed",
"(",
"partition_column",
",",
"lower_bound",
",",
"upper_bound",
")",
":",
"if",
"(",
"(",
"partition_column",
"is",
"not",
"None",
")",
"and",
"(",
"lower_bound",
"is",
"not",
"None",
")",
"and",
"(",
"upper_bound",
"is",
"not",
"... | Check if is possible distribute a query given that args
Args:
partition_column: column used to share the data between the workers
lower_bound: the minimum value to be requested from the partition_column
upper_bound: the maximum value to be requested from the partition_column
Returns:
... | [
"Check",
"if",
"is",
"possible",
"distribute",
"a",
"query",
"given",
"that",
"args"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pandas_on_ray/sql.py#L5-L31 | train |
modin-project/modin | modin/experimental/engines/pandas_on_ray/sql.py | is_table | def is_table(engine, sql):
""" Check with the given sql arg is query or table
Args:
engine: SQLAlchemy connection engine
sql: SQL query or table name
Returns:
True for table or False if not
"""
if engine.dialect.has_table(engine, sql):
return True
return False | python | def is_table(engine, sql):
""" Check with the given sql arg is query or table
Args:
engine: SQLAlchemy connection engine
sql: SQL query or table name
Returns:
True for table or False if not
"""
if engine.dialect.has_table(engine, sql):
return True
return False | [
"def",
"is_table",
"(",
"engine",
",",
"sql",
")",
":",
"if",
"engine",
".",
"dialect",
".",
"has_table",
"(",
"engine",
",",
"sql",
")",
":",
"return",
"True",
"return",
"False"
] | Check with the given sql arg is query or table
Args:
engine: SQLAlchemy connection engine
sql: SQL query or table name
Returns:
True for table or False if not | [
"Check",
"with",
"the",
"given",
"sql",
"arg",
"is",
"query",
"or",
"table"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pandas_on_ray/sql.py#L34-L46 | train |
modin-project/modin | modin/experimental/engines/pandas_on_ray/sql.py | get_table_metadata | def get_table_metadata(engine, table):
""" Extract all useful infos from the given table
Args:
engine: SQLAlchemy connection engine
table: table name
Returns:
Dictionary of infos
"""
metadata = MetaData()
metadata.reflect(bind=engine, only=[table])
table_metadata = ... | python | def get_table_metadata(engine, table):
""" Extract all useful infos from the given table
Args:
engine: SQLAlchemy connection engine
table: table name
Returns:
Dictionary of infos
"""
metadata = MetaData()
metadata.reflect(bind=engine, only=[table])
table_metadata = ... | [
"def",
"get_table_metadata",
"(",
"engine",
",",
"table",
")",
":",
"metadata",
"=",
"MetaData",
"(",
")",
"metadata",
".",
"reflect",
"(",
"bind",
"=",
"engine",
",",
"only",
"=",
"[",
"table",
"]",
")",
"table_metadata",
"=",
"Table",
"(",
"table",
"... | Extract all useful infos from the given table
Args:
engine: SQLAlchemy connection engine
table: table name
Returns:
Dictionary of infos | [
"Extract",
"all",
"useful",
"infos",
"from",
"the",
"given",
"table"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pandas_on_ray/sql.py#L49-L62 | train |
modin-project/modin | modin/experimental/engines/pandas_on_ray/sql.py | get_table_columns | def get_table_columns(metadata):
""" Extract columns names and python typos from metadata
Args:
metadata: Table metadata
Returns:
dict with columns names and python types
"""
cols = OrderedDict()
for col in metadata.c:
name = str(col).rpartition(".")[2]
cols[nam... | python | def get_table_columns(metadata):
""" Extract columns names and python typos from metadata
Args:
metadata: Table metadata
Returns:
dict with columns names and python types
"""
cols = OrderedDict()
for col in metadata.c:
name = str(col).rpartition(".")[2]
cols[nam... | [
"def",
"get_table_columns",
"(",
"metadata",
")",
":",
"cols",
"=",
"OrderedDict",
"(",
")",
"for",
"col",
"in",
"metadata",
".",
"c",
":",
"name",
"=",
"str",
"(",
"col",
")",
".",
"rpartition",
"(",
"\".\"",
")",
"[",
"2",
"]",
"cols",
"[",
"name... | Extract columns names and python typos from metadata
Args:
metadata: Table metadata
Returns:
dict with columns names and python types | [
"Extract",
"columns",
"names",
"and",
"python",
"typos",
"from",
"metadata"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pandas_on_ray/sql.py#L65-L78 | train |
modin-project/modin | modin/experimental/engines/pandas_on_ray/sql.py | check_query | def check_query(query):
""" Check query sanity
Args:
query: query string
Returns:
None
"""
q = query.lower()
if "select " not in q:
raise InvalidQuery("SELECT word not found in the query: {0}".format(query))
if " from " not in q:
raise InvalidQuery("FROM wor... | python | def check_query(query):
""" Check query sanity
Args:
query: query string
Returns:
None
"""
q = query.lower()
if "select " not in q:
raise InvalidQuery("SELECT word not found in the query: {0}".format(query))
if " from " not in q:
raise InvalidQuery("FROM wor... | [
"def",
"check_query",
"(",
"query",
")",
":",
"q",
"=",
"query",
".",
"lower",
"(",
")",
"if",
"\"select \"",
"not",
"in",
"q",
":",
"raise",
"InvalidQuery",
"(",
"\"SELECT word not found in the query: {0}\"",
".",
"format",
"(",
"query",
")",
")",
"if",
"... | Check query sanity
Args:
query: query string
Returns:
None | [
"Check",
"query",
"sanity"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pandas_on_ray/sql.py#L93-L106 | train |
modin-project/modin | modin/experimental/engines/pandas_on_ray/sql.py | get_query_columns | def get_query_columns(engine, query):
""" Extract columns names and python typos from query
Args:
engine: SQLAlchemy connection engine
query: SQL query
Returns:
dict with columns names and python types
"""
con = engine.connect()
result = con.execute(query).fetchone()
... | python | def get_query_columns(engine, query):
""" Extract columns names and python typos from query
Args:
engine: SQLAlchemy connection engine
query: SQL query
Returns:
dict with columns names and python types
"""
con = engine.connect()
result = con.execute(query).fetchone()
... | [
"def",
"get_query_columns",
"(",
"engine",
",",
"query",
")",
":",
"con",
"=",
"engine",
".",
"connect",
"(",
")",
"result",
"=",
"con",
".",
"execute",
"(",
"query",
")",
".",
"fetchone",
"(",
")",
"values",
"=",
"list",
"(",
"result",
")",
"cols_na... | Extract columns names and python typos from query
Args:
engine: SQLAlchemy connection engine
query: SQL query
Returns:
dict with columns names and python types | [
"Extract",
"columns",
"names",
"and",
"python",
"typos",
"from",
"query"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pandas_on_ray/sql.py#L109-L126 | train |
modin-project/modin | modin/experimental/engines/pandas_on_ray/sql.py | check_partition_column | def check_partition_column(partition_column, cols):
""" Check partition_column existence and type
Args:
partition_column: partition_column name
cols: dict with columns names and python types
Returns:
None
"""
for k, v in cols.items():
if k == partition_column:
... | python | def check_partition_column(partition_column, cols):
""" Check partition_column existence and type
Args:
partition_column: partition_column name
cols: dict with columns names and python types
Returns:
None
"""
for k, v in cols.items():
if k == partition_column:
... | [
"def",
"check_partition_column",
"(",
"partition_column",
",",
"cols",
")",
":",
"for",
"k",
",",
"v",
"in",
"cols",
".",
"items",
"(",
")",
":",
"if",
"k",
"==",
"partition_column",
":",
"if",
"v",
"==",
"\"int\"",
":",
"return",
"else",
":",
"raise",... | Check partition_column existence and type
Args:
partition_column: partition_column name
cols: dict with columns names and python types
Returns:
None | [
"Check",
"partition_column",
"existence",
"and",
"type"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pandas_on_ray/sql.py#L129-L149 | train |
modin-project/modin | modin/experimental/engines/pandas_on_ray/sql.py | get_query_info | def get_query_info(sql, con, partition_column):
""" Return a columns name list and the query string
Args:
sql: SQL query or table name
con: database connection or url string
partition_column: column used to share the data between the workers
Returns:
Columns name list and q... | python | def get_query_info(sql, con, partition_column):
""" Return a columns name list and the query string
Args:
sql: SQL query or table name
con: database connection or url string
partition_column: column used to share the data between the workers
Returns:
Columns name list and q... | [
"def",
"get_query_info",
"(",
"sql",
",",
"con",
",",
"partition_column",
")",
":",
"engine",
"=",
"create_engine",
"(",
"con",
")",
"if",
"is_table",
"(",
"engine",
",",
"sql",
")",
":",
"table_metadata",
"=",
"get_table_metadata",
"(",
"engine",
",",
"sq... | Return a columns name list and the query string
Args:
sql: SQL query or table name
con: database connection or url string
partition_column: column used to share the data between the workers
Returns:
Columns name list and query string | [
"Return",
"a",
"columns",
"name",
"list",
"and",
"the",
"query",
"string"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pandas_on_ray/sql.py#L152-L175 | train |
modin-project/modin | modin/experimental/engines/pandas_on_ray/sql.py | query_put_bounders | def query_put_bounders(query, partition_column, start, end):
""" Put bounders in the query
Args:
query: SQL query string
partition_column: partition_column name
start: lower_bound
end: upper_bound
Returns:
Query with bounders
"""
where = " WHERE TMP_TABLE.{0... | python | def query_put_bounders(query, partition_column, start, end):
""" Put bounders in the query
Args:
query: SQL query string
partition_column: partition_column name
start: lower_bound
end: upper_bound
Returns:
Query with bounders
"""
where = " WHERE TMP_TABLE.{0... | [
"def",
"query_put_bounders",
"(",
"query",
",",
"partition_column",
",",
"start",
",",
"end",
")",
":",
"where",
"=",
"\" WHERE TMP_TABLE.{0} >= {1} AND TMP_TABLE.{0} <= {2}\"",
".",
"format",
"(",
"partition_column",
",",
"start",
",",
"end",
")",
"query_with_bounder... | Put bounders in the query
Args:
query: SQL query string
partition_column: partition_column name
start: lower_bound
end: upper_bound
Returns:
Query with bounders | [
"Put",
"bounders",
"in",
"the",
"query"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/experimental/engines/pandas_on_ray/sql.py#L178-L194 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.compute_index | def compute_index(self, axis, data_object, compute_diff=True):
"""Computes the index after a number of rows have been removed.
Note: In order for this to be used properly, the indexes must not be
changed before you compute this.
Args:
axis: The axis to extract the index... | python | def compute_index(self, axis, data_object, compute_diff=True):
"""Computes the index after a number of rows have been removed.
Note: In order for this to be used properly, the indexes must not be
changed before you compute this.
Args:
axis: The axis to extract the index... | [
"def",
"compute_index",
"(",
"self",
",",
"axis",
",",
"data_object",
",",
"compute_diff",
"=",
"True",
")",
":",
"def",
"pandas_index_extraction",
"(",
"df",
",",
"axis",
")",
":",
"if",
"not",
"axis",
":",
"return",
"df",
".",
"index",
"else",
":",
"... | Computes the index after a number of rows have been removed.
Note: In order for this to be used properly, the indexes must not be
changed before you compute this.
Args:
axis: The axis to extract the index from.
data_object: The new data object to extract the index f... | [
"Computes",
"the",
"index",
"after",
"a",
"number",
"of",
"rows",
"have",
"been",
"removed",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L64-L98 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._prepare_method | def _prepare_method(self, pandas_func, **kwargs):
"""Prepares methods given various metadata.
Args:
pandas_func: The function to prepare.
Returns
Helper function which handles potential transpose.
"""
if self._is_transposed:
def helper(df, in... | python | def _prepare_method(self, pandas_func, **kwargs):
"""Prepares methods given various metadata.
Args:
pandas_func: The function to prepare.
Returns
Helper function which handles potential transpose.
"""
if self._is_transposed:
def helper(df, in... | [
"def",
"_prepare_method",
"(",
"self",
",",
"pandas_func",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_is_transposed",
":",
"def",
"helper",
"(",
"df",
",",
"internal_indices",
"=",
"[",
"]",
")",
":",
"if",
"len",
"(",
"internal_indices",
... | Prepares methods given various metadata.
Args:
pandas_func: The function to prepare.
Returns
Helper function which handles potential transpose. | [
"Prepares",
"methods",
"given",
"various",
"metadata",
".",
"Args",
":",
"pandas_func",
":",
"The",
"function",
"to",
"prepare",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L141-L165 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.numeric_columns | def numeric_columns(self, include_bool=True):
"""Returns the numeric columns of the Manager.
Returns:
List of index names.
"""
columns = []
for col, dtype in zip(self.columns, self.dtypes):
if is_numeric_dtype(dtype) and (
include_bool or ... | python | def numeric_columns(self, include_bool=True):
"""Returns the numeric columns of the Manager.
Returns:
List of index names.
"""
columns = []
for col, dtype in zip(self.columns, self.dtypes):
if is_numeric_dtype(dtype) and (
include_bool or ... | [
"def",
"numeric_columns",
"(",
"self",
",",
"include_bool",
"=",
"True",
")",
":",
"columns",
"=",
"[",
"]",
"for",
"col",
",",
"dtype",
"in",
"zip",
"(",
"self",
".",
"columns",
",",
"self",
".",
"dtypes",
")",
":",
"if",
"is_numeric_dtype",
"(",
"d... | Returns the numeric columns of the Manager.
Returns:
List of index names. | [
"Returns",
"the",
"numeric",
"columns",
"of",
"the",
"Manager",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L167-L179 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.numeric_function_clean_dataframe | def numeric_function_clean_dataframe(self, axis):
"""Preprocesses numeric functions to clean dataframe and pick numeric indices.
Args:
axis: '0' if columns and '1' if rows.
Returns:
Tuple with return value(if any), indices to apply func to & cleaned Manager.
"""... | python | def numeric_function_clean_dataframe(self, axis):
"""Preprocesses numeric functions to clean dataframe and pick numeric indices.
Args:
axis: '0' if columns and '1' if rows.
Returns:
Tuple with return value(if any), indices to apply func to & cleaned Manager.
"""... | [
"def",
"numeric_function_clean_dataframe",
"(",
"self",
",",
"axis",
")",
":",
"result",
"=",
"None",
"query_compiler",
"=",
"self",
"# If no numeric columns and over columns, then return empty Series",
"if",
"not",
"axis",
"and",
"len",
"(",
"self",
".",
"index",
")"... | Preprocesses numeric functions to clean dataframe and pick numeric indices.
Args:
axis: '0' if columns and '1' if rows.
Returns:
Tuple with return value(if any), indices to apply func to & cleaned Manager. | [
"Preprocesses",
"numeric",
"functions",
"to",
"clean",
"dataframe",
"and",
"pick",
"numeric",
"indices",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L181-L209 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._join_index_objects | def _join_index_objects(self, axis, other_index, how, sort=True):
"""Joins a pair of index objects (columns or rows) by a given strategy.
Args:
axis: The axis index object to join (0 for columns, 1 for index).
other_index: The other_index to join on.
how: The type of... | python | def _join_index_objects(self, axis, other_index, how, sort=True):
"""Joins a pair of index objects (columns or rows) by a given strategy.
Args:
axis: The axis index object to join (0 for columns, 1 for index).
other_index: The other_index to join on.
how: The type of... | [
"def",
"_join_index_objects",
"(",
"self",
",",
"axis",
",",
"other_index",
",",
"how",
",",
"sort",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"other_index",
",",
"list",
")",
":",
"joined_obj",
"=",
"self",
".",
"columns",
"if",
"not",
"axis",
"... | Joins a pair of index objects (columns or rows) by a given strategy.
Args:
axis: The axis index object to join (0 for columns, 1 for index).
other_index: The other_index to join on.
how: The type of join to join to make (e.g. right, left).
Returns:
Joine... | [
"Joins",
"a",
"pair",
"of",
"index",
"objects",
"(",
"columns",
"or",
"rows",
")",
"by",
"a",
"given",
"strategy",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L268-L289 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.join | def join(self, other, **kwargs):
"""Joins a list or two objects together.
Args:
other: The other object(s) to join on.
Returns:
Joined objects.
"""
if not isinstance(other, list):
other = [other]
return self._join_list_of_managers(oth... | python | def join(self, other, **kwargs):
"""Joins a list or two objects together.
Args:
other: The other object(s) to join on.
Returns:
Joined objects.
"""
if not isinstance(other, list):
other = [other]
return self._join_list_of_managers(oth... | [
"def",
"join",
"(",
"self",
",",
"other",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"list",
")",
":",
"other",
"=",
"[",
"other",
"]",
"return",
"self",
".",
"_join_list_of_managers",
"(",
"other",
",",
"*",
"... | Joins a list or two objects together.
Args:
other: The other object(s) to join on.
Returns:
Joined objects. | [
"Joins",
"a",
"list",
"or",
"two",
"objects",
"together",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L291-L302 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.concat | def concat(self, axis, other, **kwargs):
"""Concatenates two objects together.
Args:
axis: The axis index object to join (0 for columns, 1 for index).
other: The other_index to concat with.
Returns:
Concatenated objects.
"""
return self._appe... | python | def concat(self, axis, other, **kwargs):
"""Concatenates two objects together.
Args:
axis: The axis index object to join (0 for columns, 1 for index).
other: The other_index to concat with.
Returns:
Concatenated objects.
"""
return self._appe... | [
"def",
"concat",
"(",
"self",
",",
"axis",
",",
"other",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_append_list_of_managers",
"(",
"other",
",",
"axis",
",",
"*",
"*",
"kwargs",
")"
] | Concatenates two objects together.
Args:
axis: The axis index object to join (0 for columns, 1 for index).
other: The other_index to concat with.
Returns:
Concatenated objects. | [
"Concatenates",
"two",
"objects",
"together",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L304-L314 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.copartition | def copartition(self, axis, other, how_to_join, sort, force_repartition=False):
"""Copartition two QueryCompiler objects.
Args:
axis: The axis to copartition along.
other: The other Query Compiler(s) to copartition against.
how_to_join: How to manage joining the inde... | python | def copartition(self, axis, other, how_to_join, sort, force_repartition=False):
"""Copartition two QueryCompiler objects.
Args:
axis: The axis to copartition along.
other: The other Query Compiler(s) to copartition against.
how_to_join: How to manage joining the inde... | [
"def",
"copartition",
"(",
"self",
",",
"axis",
",",
"other",
",",
"how_to_join",
",",
"sort",
",",
"force_repartition",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"type",
"(",
"self",
")",
")",
":",
"other",
"=",
"[",
"other",
"]... | Copartition two QueryCompiler objects.
Args:
axis: The axis to copartition along.
other: The other Query Compiler(s) to copartition against.
how_to_join: How to manage joining the index object ("left", "right", etc.)
sort: Whether or not to sort the joined index.... | [
"Copartition",
"two",
"QueryCompiler",
"objects",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L380-L456 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.to_pandas | def to_pandas(self):
"""Converts Modin DataFrame to Pandas DataFrame.
Returns:
Pandas DataFrame of the DataManager.
"""
df = self.data.to_pandas(is_transposed=self._is_transposed)
if df.empty:
if len(self.columns) != 0:
df = pandas.DataFra... | python | def to_pandas(self):
"""Converts Modin DataFrame to Pandas DataFrame.
Returns:
Pandas DataFrame of the DataManager.
"""
df = self.data.to_pandas(is_transposed=self._is_transposed)
if df.empty:
if len(self.columns) != 0:
df = pandas.DataFra... | [
"def",
"to_pandas",
"(",
"self",
")",
":",
"df",
"=",
"self",
".",
"data",
".",
"to_pandas",
"(",
"is_transposed",
"=",
"self",
".",
"_is_transposed",
")",
"if",
"df",
".",
"empty",
":",
"if",
"len",
"(",
"self",
".",
"columns",
")",
"!=",
"0",
":"... | Converts Modin DataFrame to Pandas DataFrame.
Returns:
Pandas DataFrame of the DataManager. | [
"Converts",
"Modin",
"DataFrame",
"to",
"Pandas",
"DataFrame",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L468-L486 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.from_pandas | def from_pandas(cls, df, block_partitions_cls):
"""Improve simple Pandas DataFrame to an advanced and superior Modin DataFrame.
Args:
cls: DataManger object to convert the DataFrame to.
df: Pandas DataFrame object.
block_partitions_cls: BlockParitions object to store... | python | def from_pandas(cls, df, block_partitions_cls):
"""Improve simple Pandas DataFrame to an advanced and superior Modin DataFrame.
Args:
cls: DataManger object to convert the DataFrame to.
df: Pandas DataFrame object.
block_partitions_cls: BlockParitions object to store... | [
"def",
"from_pandas",
"(",
"cls",
",",
"df",
",",
"block_partitions_cls",
")",
":",
"new_index",
"=",
"df",
".",
"index",
"new_columns",
"=",
"df",
".",
"columns",
"new_dtypes",
"=",
"df",
".",
"dtypes",
"new_data",
"=",
"block_partitions_cls",
".",
"from_pa... | Improve simple Pandas DataFrame to an advanced and superior Modin DataFrame.
Args:
cls: DataManger object to convert the DataFrame to.
df: Pandas DataFrame object.
block_partitions_cls: BlockParitions object to store partitions
Returns:
Returns DataManag... | [
"Improve",
"simple",
"Pandas",
"DataFrame",
"to",
"an",
"advanced",
"and",
"superior",
"Modin",
"DataFrame",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L489-L504 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._inter_manager_operations | def _inter_manager_operations(self, other, how_to_join, func):
"""Inter-data operations (e.g. add, sub).
Args:
other: The other Manager for the operation.
how_to_join: The type of join to join to make (e.g. right, outer).
Returns:
New DataManager with new da... | python | def _inter_manager_operations(self, other, how_to_join, func):
"""Inter-data operations (e.g. add, sub).
Args:
other: The other Manager for the operation.
how_to_join: The type of join to join to make (e.g. right, outer).
Returns:
New DataManager with new da... | [
"def",
"_inter_manager_operations",
"(",
"self",
",",
"other",
",",
"how_to_join",
",",
"func",
")",
":",
"reindexed_self",
",",
"reindexed_other_list",
",",
"joined_index",
"=",
"self",
".",
"copartition",
"(",
"0",
",",
"other",
",",
"how_to_join",
",",
"Fal... | Inter-data operations (e.g. add, sub).
Args:
other: The other Manager for the operation.
how_to_join: The type of join to join to make (e.g. right, outer).
Returns:
New DataManager with new data and index. | [
"Inter",
"-",
"data",
"operations",
"(",
"e",
".",
"g",
".",
"add",
"sub",
")",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L513-L552 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._inter_df_op_handler | def _inter_df_op_handler(self, func, other, **kwargs):
"""Helper method for inter-manager and scalar operations.
Args:
func: The function to use on the Manager/scalar.
other: The other Manager/scalar.
Returns:
New DataManager with new data and index.
... | python | def _inter_df_op_handler(self, func, other, **kwargs):
"""Helper method for inter-manager and scalar operations.
Args:
func: The function to use on the Manager/scalar.
other: The other Manager/scalar.
Returns:
New DataManager with new data and index.
... | [
"def",
"_inter_df_op_handler",
"(",
"self",
",",
"func",
",",
"other",
",",
"*",
"*",
"kwargs",
")",
":",
"axis",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"axis",
"=",
"pandas",
".",
"DataFrame",
"(",
")",
".",
"_get_axis_number",
"... | Helper method for inter-manager and scalar operations.
Args:
func: The function to use on the Manager/scalar.
other: The other Manager/scalar.
Returns:
New DataManager with new data and index. | [
"Helper",
"method",
"for",
"inter",
"-",
"manager",
"and",
"scalar",
"operations",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L554-L573 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.binary_op | def binary_op(self, op, other, **kwargs):
"""Perform an operation between two objects.
Note: The list of operations is as follows:
- add
- eq
- floordiv
- ge
- gt
- le
- lt
- mod
- mul
... | python | def binary_op(self, op, other, **kwargs):
"""Perform an operation between two objects.
Note: The list of operations is as follows:
- add
- eq
- floordiv
- ge
- gt
- le
- lt
- mod
- mul
... | [
"def",
"binary_op",
"(",
"self",
",",
"op",
",",
"other",
",",
"*",
"*",
"kwargs",
")",
":",
"func",
"=",
"getattr",
"(",
"pandas",
".",
"DataFrame",
",",
"op",
")",
"return",
"self",
".",
"_inter_df_op_handler",
"(",
"func",
",",
"other",
",",
"*",
... | Perform an operation between two objects.
Note: The list of operations is as follows:
- add
- eq
- floordiv
- ge
- gt
- le
- lt
- mod
- mul
- ne
- pow
- rfloordiv
... | [
"Perform",
"an",
"operation",
"between",
"two",
"objects",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L575-L608 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.update | def update(self, other, **kwargs):
"""Uses other manager to update corresponding values in this manager.
Args:
other: The other manager.
Returns:
New DataManager with updated data and index.
"""
assert isinstance(
other, type(self)
),... | python | def update(self, other, **kwargs):
"""Uses other manager to update corresponding values in this manager.
Args:
other: The other manager.
Returns:
New DataManager with updated data and index.
"""
assert isinstance(
other, type(self)
),... | [
"def",
"update",
"(",
"self",
",",
"other",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"isinstance",
"(",
"other",
",",
"type",
"(",
"self",
")",
")",
",",
"\"Must have the same DataManager subclass to perform this operation\"",
"def",
"update_builder",
"(",
"... | Uses other manager to update corresponding values in this manager.
Args:
other: The other manager.
Returns:
New DataManager with updated data and index. | [
"Uses",
"other",
"manager",
"to",
"update",
"corresponding",
"values",
"in",
"this",
"manager",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L620-L639 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.where | def where(self, cond, other, **kwargs):
"""Gets values from this manager where cond is true else from other.
Args:
cond: Condition on which to evaluate values.
Returns:
New DataManager with updated data and index.
"""
assert isinstance(
cond... | python | def where(self, cond, other, **kwargs):
"""Gets values from this manager where cond is true else from other.
Args:
cond: Condition on which to evaluate values.
Returns:
New DataManager with updated data and index.
"""
assert isinstance(
cond... | [
"def",
"where",
"(",
"self",
",",
"cond",
",",
"other",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"isinstance",
"(",
"cond",
",",
"type",
"(",
"self",
")",
")",
",",
"\"Must have the same DataManager subclass to perform this operation\"",
"if",
"isinstance",
... | Gets values from this manager where cond is true else from other.
Args:
cond: Condition on which to evaluate values.
Returns:
New DataManager with updated data and index. | [
"Gets",
"values",
"from",
"this",
"manager",
"where",
"cond",
"is",
"true",
"else",
"from",
"other",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L641-L697 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._scalar_operations | def _scalar_operations(self, axis, scalar, func):
"""Handler for mapping scalar operations across a Manager.
Args:
axis: The axis index object to execute the function on.
scalar: The scalar value to map.
func: The function to use on the Manager with the scalar.
... | python | def _scalar_operations(self, axis, scalar, func):
"""Handler for mapping scalar operations across a Manager.
Args:
axis: The axis index object to execute the function on.
scalar: The scalar value to map.
func: The function to use on the Manager with the scalar.
... | [
"def",
"_scalar_operations",
"(",
"self",
",",
"axis",
",",
"scalar",
",",
"func",
")",
":",
"if",
"isinstance",
"(",
"scalar",
",",
"(",
"list",
",",
"np",
".",
"ndarray",
",",
"pandas",
".",
"Series",
")",
")",
":",
"new_index",
"=",
"self",
".",
... | Handler for mapping scalar operations across a Manager.
Args:
axis: The axis index object to execute the function on.
scalar: The scalar value to map.
func: The function to use on the Manager with the scalar.
Returns:
A new QueryCompiler with updated dat... | [
"Handler",
"for",
"mapping",
"scalar",
"operations",
"across",
"a",
"Manager",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L702-L728 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.reindex | def reindex(self, axis, labels, **kwargs):
"""Fits a new index for this Manger.
Args:
axis: The axis index object to target the reindex on.
labels: New labels to conform 'axis' on to.
Returns:
A new QueryCompiler with updated data and new index.
"""
... | python | def reindex(self, axis, labels, **kwargs):
"""Fits a new index for this Manger.
Args:
axis: The axis index object to target the reindex on.
labels: New labels to conform 'axis' on to.
Returns:
A new QueryCompiler with updated data and new index.
"""
... | [
"def",
"reindex",
"(",
"self",
",",
"axis",
",",
"labels",
",",
"*",
"*",
"kwargs",
")",
":",
"# To reindex, we need a function that will be shipped to each of the",
"# partitions.",
"def",
"reindex_builer",
"(",
"df",
",",
"axis",
",",
"old_labels",
",",
"new_label... | Fits a new index for this Manger.
Args:
axis: The axis index object to target the reindex on.
labels: New labels to conform 'axis' on to.
Returns:
A new QueryCompiler with updated data and new index. | [
"Fits",
"a",
"new",
"index",
"for",
"this",
"Manger",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L733-L777 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.reset_index | def reset_index(self, **kwargs):
"""Removes all levels from index and sets a default level_0 index.
Returns:
A new QueryCompiler with updated data and reset index.
"""
drop = kwargs.get("drop", False)
new_index = pandas.RangeIndex(len(self.index))
if not drop... | python | def reset_index(self, **kwargs):
"""Removes all levels from index and sets a default level_0 index.
Returns:
A new QueryCompiler with updated data and reset index.
"""
drop = kwargs.get("drop", False)
new_index = pandas.RangeIndex(len(self.index))
if not drop... | [
"def",
"reset_index",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"drop",
"=",
"kwargs",
".",
"get",
"(",
"\"drop\"",
",",
"False",
")",
"new_index",
"=",
"pandas",
".",
"RangeIndex",
"(",
"len",
"(",
"self",
".",
"index",
")",
")",
"if",
"not"... | Removes all levels from index and sets a default level_0 index.
Returns:
A new QueryCompiler with updated data and reset index. | [
"Removes",
"all",
"levels",
"from",
"index",
"and",
"sets",
"a",
"default",
"level_0",
"index",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L779-L811 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.transpose | def transpose(self, *args, **kwargs):
"""Transposes this DataManager.
Returns:
Transposed new DataManager.
"""
new_data = self.data.transpose(*args, **kwargs)
# Switch the index and columns and transpose the
new_manager = self.__constructor__(new_data, self.c... | python | def transpose(self, *args, **kwargs):
"""Transposes this DataManager.
Returns:
Transposed new DataManager.
"""
new_data = self.data.transpose(*args, **kwargs)
# Switch the index and columns and transpose the
new_manager = self.__constructor__(new_data, self.c... | [
"def",
"transpose",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"new_data",
"=",
"self",
".",
"data",
".",
"transpose",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"# Switch the index and columns and transpose the",
"new_manager",
... | Transposes this DataManager.
Returns:
Transposed new DataManager. | [
"Transposes",
"this",
"DataManager",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L828-L839 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._full_reduce | def _full_reduce(self, axis, map_func, reduce_func=None):
"""Apply function that will reduce the data to a Pandas Series.
Args:
axis: 0 for columns and 1 for rows. Default is 0.
map_func: Callable function to map the dataframe.
reduce_func: Callable function to reduc... | python | def _full_reduce(self, axis, map_func, reduce_func=None):
"""Apply function that will reduce the data to a Pandas Series.
Args:
axis: 0 for columns and 1 for rows. Default is 0.
map_func: Callable function to map the dataframe.
reduce_func: Callable function to reduc... | [
"def",
"_full_reduce",
"(",
"self",
",",
"axis",
",",
"map_func",
",",
"reduce_func",
"=",
"None",
")",
":",
"if",
"reduce_func",
"is",
"None",
":",
"reduce_func",
"=",
"map_func",
"mapped_parts",
"=",
"self",
".",
"data",
".",
"map_across_blocks",
"(",
"m... | Apply function that will reduce the data to a Pandas Series.
Args:
axis: 0 for columns and 1 for rows. Default is 0.
map_func: Callable function to map the dataframe.
reduce_func: Callable function to reduce the dataframe. If none,
then apply map_func twice.
... | [
"Apply",
"function",
"that",
"will",
"reduce",
"the",
"data",
"to",
"a",
"Pandas",
"Series",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L847-L874 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.count | def count(self, **kwargs):
"""Counts the number of non-NaN objects for each column or row.
Return:
A new QueryCompiler object containing counts of non-NaN objects from each
column or row.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis",... | python | def count(self, **kwargs):
"""Counts the number of non-NaN objects for each column or row.
Return:
A new QueryCompiler object containing counts of non-NaN objects from each
column or row.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis",... | [
"def",
"count",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_is_transposed",
":",
"kwargs",
"[",
"\"axis\"",
"]",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"^",
"1",
"return",
"self",
".",
"transpose",
"(",
... | Counts the number of non-NaN objects for each column or row.
Return:
A new QueryCompiler object containing counts of non-NaN objects from each
column or row. | [
"Counts",
"the",
"number",
"of",
"non",
"-",
"NaN",
"objects",
"for",
"each",
"column",
"or",
"row",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L893-L906 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.mean | def mean(self, **kwargs):
"""Returns the mean for each numerical column or row.
Return:
A new QueryCompiler object containing the mean from each numerical column or
row.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
... | python | def mean(self, **kwargs):
"""Returns the mean for each numerical column or row.
Return:
A new QueryCompiler object containing the mean from each numerical column or
row.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
... | [
"def",
"mean",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_is_transposed",
":",
"kwargs",
"[",
"\"axis\"",
"]",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"^",
"1",
"return",
"self",
".",
"transpose",
"(",
... | Returns the mean for each numerical column or row.
Return:
A new QueryCompiler object containing the mean from each numerical column or
row. | [
"Returns",
"the",
"mean",
"for",
"each",
"numerical",
"column",
"or",
"row",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L920-L938 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.min | def min(self, **kwargs):
"""Returns the minimum from each column or row.
Return:
A new QueryCompiler object with the minimum value from each column or row.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.transpose().... | python | def min(self, **kwargs):
"""Returns the minimum from each column or row.
Return:
A new QueryCompiler object with the minimum value from each column or row.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.transpose().... | [
"def",
"min",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_is_transposed",
":",
"kwargs",
"[",
"\"axis\"",
"]",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"^",
"1",
"return",
"self",
".",
"transpose",
"(",
... | Returns the minimum from each column or row.
Return:
A new QueryCompiler object with the minimum value from each column or row. | [
"Returns",
"the",
"minimum",
"from",
"each",
"column",
"or",
"row",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L940-L950 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._process_sum_prod | def _process_sum_prod(self, func, **kwargs):
"""Calculates the sum or product of the DataFrame.
Args:
func: Pandas func to apply to DataFrame.
ignore_axis: Whether to ignore axis when raising TypeError
Return:
A new QueryCompiler object with sum or prod of th... | python | def _process_sum_prod(self, func, **kwargs):
"""Calculates the sum or product of the DataFrame.
Args:
func: Pandas func to apply to DataFrame.
ignore_axis: Whether to ignore axis when raising TypeError
Return:
A new QueryCompiler object with sum or prod of th... | [
"def",
"_process_sum_prod",
"(",
"self",
",",
"func",
",",
"*",
"*",
"kwargs",
")",
":",
"axis",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"min_count",
"=",
"kwargs",
".",
"get",
"(",
"\"min_count\"",
",",
"0",
")",
"def",
"sum_prod_... | Calculates the sum or product of the DataFrame.
Args:
func: Pandas func to apply to DataFrame.
ignore_axis: Whether to ignore axis when raising TypeError
Return:
A new QueryCompiler object with sum or prod of the object. | [
"Calculates",
"the",
"sum",
"or",
"product",
"of",
"the",
"DataFrame",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L952-L970 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.prod | def prod(self, **kwargs):
"""Returns the product of each numerical column or row.
Return:
A new QueryCompiler object with the product of each numerical column or row.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.t... | python | def prod(self, **kwargs):
"""Returns the product of each numerical column or row.
Return:
A new QueryCompiler object with the product of each numerical column or row.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.t... | [
"def",
"prod",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_is_transposed",
":",
"kwargs",
"[",
"\"axis\"",
"]",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"^",
"1",
"return",
"self",
".",
"transpose",
"(",
... | Returns the product of each numerical column or row.
Return:
A new QueryCompiler object with the product of each numerical column or row. | [
"Returns",
"the",
"product",
"of",
"each",
"numerical",
"column",
"or",
"row",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L972-L983 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._process_all_any | def _process_all_any(self, func, **kwargs):
"""Calculates if any or all the values are true.
Return:
A new QueryCompiler object containing boolean values or boolean.
"""
axis = kwargs.get("axis", 0)
axis = 0 if axis is None else axis
kwargs["axis"] = axis
... | python | def _process_all_any(self, func, **kwargs):
"""Calculates if any or all the values are true.
Return:
A new QueryCompiler object containing boolean values or boolean.
"""
axis = kwargs.get("axis", 0)
axis = 0 if axis is None else axis
kwargs["axis"] = axis
... | [
"def",
"_process_all_any",
"(",
"self",
",",
"func",
",",
"*",
"*",
"kwargs",
")",
":",
"axis",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"axis",
"=",
"0",
"if",
"axis",
"is",
"None",
"else",
"axis",
"kwargs",
"[",
"\"axis\"",
"]",... | Calculates if any or all the values are true.
Return:
A new QueryCompiler object containing boolean values or boolean. | [
"Calculates",
"if",
"any",
"or",
"all",
"the",
"values",
"are",
"true",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L998-L1008 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.all | def all(self, **kwargs):
"""Returns whether all the elements are true, potentially over an axis.
Return:
A new QueryCompiler object containing boolean values or boolean.
"""
if self._is_transposed:
# Pandas ignores on axis=1
kwargs["bool_only"] = Fals... | python | def all(self, **kwargs):
"""Returns whether all the elements are true, potentially over an axis.
Return:
A new QueryCompiler object containing boolean values or boolean.
"""
if self._is_transposed:
# Pandas ignores on axis=1
kwargs["bool_only"] = Fals... | [
"def",
"all",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_is_transposed",
":",
"# Pandas ignores on axis=1",
"kwargs",
"[",
"\"bool_only\"",
"]",
"=",
"False",
"kwargs",
"[",
"\"axis\"",
"]",
"=",
"kwargs",
".",
"get",
"(",
"\"ax... | Returns whether all the elements are true, potentially over an axis.
Return:
A new QueryCompiler object containing boolean values or boolean. | [
"Returns",
"whether",
"all",
"the",
"elements",
"are",
"true",
"potentially",
"over",
"an",
"axis",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1010-L1021 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.astype | def astype(self, col_dtypes, **kwargs):
"""Converts columns dtypes to given dtypes.
Args:
col_dtypes: Dictionary of {col: dtype,...} where col is the column
name and dtype is a numpy dtype.
Returns:
DataFrame with updated dtypes.
"""
# Gr... | python | def astype(self, col_dtypes, **kwargs):
"""Converts columns dtypes to given dtypes.
Args:
col_dtypes: Dictionary of {col: dtype,...} where col is the column
name and dtype is a numpy dtype.
Returns:
DataFrame with updated dtypes.
"""
# Gr... | [
"def",
"astype",
"(",
"self",
",",
"col_dtypes",
",",
"*",
"*",
"kwargs",
")",
":",
"# Group indices to update by dtype for less map operations",
"dtype_indices",
"=",
"{",
"}",
"columns",
"=",
"col_dtypes",
".",
"keys",
"(",
")",
"numeric_indices",
"=",
"list",
... | Converts columns dtypes to given dtypes.
Args:
col_dtypes: Dictionary of {col: dtype,...} where col is the column
name and dtype is a numpy dtype.
Returns:
DataFrame with updated dtypes. | [
"Converts",
"columns",
"dtypes",
"to",
"given",
"dtypes",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1090-L1140 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._full_axis_reduce | def _full_axis_reduce(self, axis, func, alternate_index=None):
"""Applies map that reduce Manager to series but require knowledge of full axis.
Args:
func: Function to reduce the Manager by. This function takes in a Manager.
axis: axis to apply the function to.
alter... | python | def _full_axis_reduce(self, axis, func, alternate_index=None):
"""Applies map that reduce Manager to series but require knowledge of full axis.
Args:
func: Function to reduce the Manager by. This function takes in a Manager.
axis: axis to apply the function to.
alter... | [
"def",
"_full_axis_reduce",
"(",
"self",
",",
"axis",
",",
"func",
",",
"alternate_index",
"=",
"None",
")",
":",
"result",
"=",
"self",
".",
"data",
".",
"map_across_full_axis",
"(",
"axis",
",",
"func",
")",
"if",
"axis",
"==",
"0",
":",
"columns",
"... | Applies map that reduce Manager to series but require knowledge of full axis.
Args:
func: Function to reduce the Manager by. This function takes in a Manager.
axis: axis to apply the function to.
alternate_index: If the resulting series should have an index
d... | [
"Applies",
"map",
"that",
"reduce",
"Manager",
"to",
"series",
"but",
"require",
"knowledge",
"of",
"full",
"axis",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1148-L1166 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.first_valid_index | def first_valid_index(self):
"""Returns index of first non-NaN/NULL value.
Return:
Scalar of index name.
"""
# It may be possible to incrementally check each partition, but this
# computation is fairly cheap.
def first_valid_index_builder(df):
df.... | python | def first_valid_index(self):
"""Returns index of first non-NaN/NULL value.
Return:
Scalar of index name.
"""
# It may be possible to incrementally check each partition, but this
# computation is fairly cheap.
def first_valid_index_builder(df):
df.... | [
"def",
"first_valid_index",
"(",
"self",
")",
":",
"# It may be possible to incrementally check each partition, but this",
"# computation is fairly cheap.",
"def",
"first_valid_index_builder",
"(",
"df",
")",
":",
"df",
".",
"index",
"=",
"pandas",
".",
"RangeIndex",
"(",
... | Returns index of first non-NaN/NULL value.
Return:
Scalar of index name. | [
"Returns",
"index",
"of",
"first",
"non",
"-",
"NaN",
"/",
"NULL",
"value",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1168-L1185 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.idxmax | def idxmax(self, **kwargs):
"""Returns the first occurrence of the maximum over requested axis.
Returns:
A new QueryCompiler object containing the maximum of each column or axis.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
r... | python | def idxmax(self, **kwargs):
"""Returns the first occurrence of the maximum over requested axis.
Returns:
A new QueryCompiler object containing the maximum of each column or axis.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
r... | [
"def",
"idxmax",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_is_transposed",
":",
"kwargs",
"[",
"\"axis\"",
"]",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"^",
"1",
"return",
"self",
".",
"transpose",
"(",... | Returns the first occurrence of the maximum over requested axis.
Returns:
A new QueryCompiler object containing the maximum of each column or axis. | [
"Returns",
"the",
"first",
"occurrence",
"of",
"the",
"maximum",
"over",
"requested",
"axis",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1187-L1208 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.idxmin | def idxmin(self, **kwargs):
"""Returns the first occurrence of the minimum over requested axis.
Returns:
A new QueryCompiler object containing the minimum of each column or axis.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
r... | python | def idxmin(self, **kwargs):
"""Returns the first occurrence of the minimum over requested axis.
Returns:
A new QueryCompiler object containing the minimum of each column or axis.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
r... | [
"def",
"idxmin",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_is_transposed",
":",
"kwargs",
"[",
"\"axis\"",
"]",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"^",
"1",
"return",
"self",
".",
"transpose",
"(",... | Returns the first occurrence of the minimum over requested axis.
Returns:
A new QueryCompiler object containing the minimum of each column or axis. | [
"Returns",
"the",
"first",
"occurrence",
"of",
"the",
"minimum",
"over",
"requested",
"axis",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1210-L1231 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.last_valid_index | def last_valid_index(self):
"""Returns index of last non-NaN/NULL value.
Return:
Scalar of index name.
"""
def last_valid_index_builder(df):
df.index = pandas.RangeIndex(len(df.index))
return df.apply(lambda df: df.last_valid_index())
func =... | python | def last_valid_index(self):
"""Returns index of last non-NaN/NULL value.
Return:
Scalar of index name.
"""
def last_valid_index_builder(df):
df.index = pandas.RangeIndex(len(df.index))
return df.apply(lambda df: df.last_valid_index())
func =... | [
"def",
"last_valid_index",
"(",
"self",
")",
":",
"def",
"last_valid_index_builder",
"(",
"df",
")",
":",
"df",
".",
"index",
"=",
"pandas",
".",
"RangeIndex",
"(",
"len",
"(",
"df",
".",
"index",
")",
")",
"return",
"df",
".",
"apply",
"(",
"lambda",
... | Returns index of last non-NaN/NULL value.
Return:
Scalar of index name. | [
"Returns",
"index",
"of",
"last",
"non",
"-",
"NaN",
"/",
"NULL",
"value",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1233-L1249 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.median | def median(self, **kwargs):
"""Returns median of each column or row.
Returns:
A new QueryCompiler object containing the median of each column or row.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.transpose().median... | python | def median(self, **kwargs):
"""Returns median of each column or row.
Returns:
A new QueryCompiler object containing the median of each column or row.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.transpose().median... | [
"def",
"median",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_is_transposed",
":",
"kwargs",
"[",
"\"axis\"",
"]",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"^",
"1",
"return",
"self",
".",
"transpose",
"(",... | Returns median of each column or row.
Returns:
A new QueryCompiler object containing the median of each column or row. | [
"Returns",
"median",
"of",
"each",
"column",
"or",
"row",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1251-L1263 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.memory_usage | def memory_usage(self, **kwargs):
"""Returns the memory usage of each column.
Returns:
A new QueryCompiler object containing the memory usage of each column.
"""
def memory_usage_builder(df, **kwargs):
return df.memory_usage(**kwargs)
func = self._build... | python | def memory_usage(self, **kwargs):
"""Returns the memory usage of each column.
Returns:
A new QueryCompiler object containing the memory usage of each column.
"""
def memory_usage_builder(df, **kwargs):
return df.memory_usage(**kwargs)
func = self._build... | [
"def",
"memory_usage",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"memory_usage_builder",
"(",
"df",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"df",
".",
"memory_usage",
"(",
"*",
"*",
"kwargs",
")",
"func",
"=",
"self",
".",
"_build_m... | Returns the memory usage of each column.
Returns:
A new QueryCompiler object containing the memory usage of each column. | [
"Returns",
"the",
"memory",
"usage",
"of",
"each",
"column",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1265-L1276 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.quantile_for_single_value | def quantile_for_single_value(self, **kwargs):
"""Returns quantile of each column or row.
Returns:
A new QueryCompiler object containing the quantile of each column or row.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return ... | python | def quantile_for_single_value(self, **kwargs):
"""Returns quantile of each column or row.
Returns:
A new QueryCompiler object containing the quantile of each column or row.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return ... | [
"def",
"quantile_for_single_value",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_is_transposed",
":",
"kwargs",
"[",
"\"axis\"",
"]",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"^",
"1",
"return",
"self",
".",
... | Returns quantile of each column or row.
Returns:
A new QueryCompiler object containing the quantile of each column or row. | [
"Returns",
"quantile",
"of",
"each",
"column",
"or",
"row",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1291-L1316 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._full_axis_reduce_along_select_indices | def _full_axis_reduce_along_select_indices(self, func, axis, index):
"""Reduce Manger along select indices using function that needs full axis.
Args:
func: Callable that reduces the dimension of the object and requires full
knowledge of the entire axis.
axis: 0 f... | python | def _full_axis_reduce_along_select_indices(self, func, axis, index):
"""Reduce Manger along select indices using function that needs full axis.
Args:
func: Callable that reduces the dimension of the object and requires full
knowledge of the entire axis.
axis: 0 f... | [
"def",
"_full_axis_reduce_along_select_indices",
"(",
"self",
",",
"func",
",",
"axis",
",",
"index",
")",
":",
"# Convert indices to numeric indices",
"old_index",
"=",
"self",
".",
"index",
"if",
"axis",
"else",
"self",
".",
"columns",
"numeric_indices",
"=",
"[... | Reduce Manger along select indices using function that needs full axis.
Args:
func: Callable that reduces the dimension of the object and requires full
knowledge of the entire axis.
axis: 0 for columns and 1 for rows. Defaults to 0.
index: Index of the result... | [
"Reduce",
"Manger",
"along",
"select",
"indices",
"using",
"function",
"that",
"needs",
"full",
"axis",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1367-L1385 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.describe | def describe(self, **kwargs):
"""Generates descriptive statistics.
Returns:
DataFrame object containing the descriptive statistics of the DataFrame.
"""
# Use pandas to calculate the correct columns
new_columns = (
pandas.DataFrame(columns=self.columns)
... | python | def describe(self, **kwargs):
"""Generates descriptive statistics.
Returns:
DataFrame object containing the descriptive statistics of the DataFrame.
"""
# Use pandas to calculate the correct columns
new_columns = (
pandas.DataFrame(columns=self.columns)
... | [
"def",
"describe",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Use pandas to calculate the correct columns",
"new_columns",
"=",
"(",
"pandas",
".",
"DataFrame",
"(",
"columns",
"=",
"self",
".",
"columns",
")",
".",
"astype",
"(",
"self",
".",
"dtype... | Generates descriptive statistics.
Returns:
DataFrame object containing the descriptive statistics of the DataFrame. | [
"Generates",
"descriptive",
"statistics",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1387-L1408 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.dropna | def dropna(self, **kwargs):
"""Returns a new QueryCompiler with null values dropped along given axis.
Return:
a new DataManager
"""
axis = kwargs.get("axis", 0)
subset = kwargs.get("subset", None)
thresh = kwargs.get("thresh", None)
how = kwargs.get("h... | python | def dropna(self, **kwargs):
"""Returns a new QueryCompiler with null values dropped along given axis.
Return:
a new DataManager
"""
axis = kwargs.get("axis", 0)
subset = kwargs.get("subset", None)
thresh = kwargs.get("thresh", None)
how = kwargs.get("h... | [
"def",
"dropna",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"axis",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"subset",
"=",
"kwargs",
".",
"get",
"(",
"\"subset\"",
",",
"None",
")",
"thresh",
"=",
"kwargs",
".",
"get",
"("... | Returns a new QueryCompiler with null values dropped along given axis.
Return:
a new DataManager | [
"Returns",
"a",
"new",
"QueryCompiler",
"with",
"null",
"values",
"dropped",
"along",
"given",
"axis",
".",
"Return",
":",
"a",
"new",
"DataManager"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1460-L1525 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.eval | def eval(self, expr, **kwargs):
"""Returns a new QueryCompiler with expr evaluated on columns.
Args:
expr: The string expression to evaluate.
Returns:
A new QueryCompiler with new columns after applying expr.
"""
columns = self.index if self._is_transpos... | python | def eval(self, expr, **kwargs):
"""Returns a new QueryCompiler with expr evaluated on columns.
Args:
expr: The string expression to evaluate.
Returns:
A new QueryCompiler with new columns after applying expr.
"""
columns = self.index if self._is_transpos... | [
"def",
"eval",
"(",
"self",
",",
"expr",
",",
"*",
"*",
"kwargs",
")",
":",
"columns",
"=",
"self",
".",
"index",
"if",
"self",
".",
"_is_transposed",
"else",
"self",
".",
"columns",
"index",
"=",
"self",
".",
"columns",
"if",
"self",
".",
"_is_trans... | Returns a new QueryCompiler with expr evaluated on columns.
Args:
expr: The string expression to evaluate.
Returns:
A new QueryCompiler with new columns after applying expr. | [
"Returns",
"a",
"new",
"QueryCompiler",
"with",
"expr",
"evaluated",
"on",
"columns",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1527-L1562 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.mode | def mode(self, **kwargs):
"""Returns a new QueryCompiler with modes calculated for each label along given axis.
Returns:
A new QueryCompiler with modes calculated.
"""
axis = kwargs.get("axis", 0)
def mode_builder(df, **kwargs):
result = df.mode(**kwargs... | python | def mode(self, **kwargs):
"""Returns a new QueryCompiler with modes calculated for each label along given axis.
Returns:
A new QueryCompiler with modes calculated.
"""
axis = kwargs.get("axis", 0)
def mode_builder(df, **kwargs):
result = df.mode(**kwargs... | [
"def",
"mode",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"axis",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"def",
"mode_builder",
"(",
"df",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"df",
".",
"mode",
"(",
"*",
... | Returns a new QueryCompiler with modes calculated for each label along given axis.
Returns:
A new QueryCompiler with modes calculated. | [
"Returns",
"a",
"new",
"QueryCompiler",
"with",
"modes",
"calculated",
"for",
"each",
"label",
"along",
"given",
"axis",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1564-L1601 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.fillna | def fillna(self, **kwargs):
"""Replaces NaN values with the method provided.
Returns:
A new QueryCompiler with null values filled.
"""
axis = kwargs.get("axis", 0)
value = kwargs.get("value")
if isinstance(value, dict):
value = kwargs.pop("value")... | python | def fillna(self, **kwargs):
"""Replaces NaN values with the method provided.
Returns:
A new QueryCompiler with null values filled.
"""
axis = kwargs.get("axis", 0)
value = kwargs.get("value")
if isinstance(value, dict):
value = kwargs.pop("value")... | [
"def",
"fillna",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"axis",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"value",
"=",
"kwargs",
".",
"get",
"(",
"\"value\"",
")",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
":"... | Replaces NaN values with the method provided.
Returns:
A new QueryCompiler with null values filled. | [
"Replaces",
"NaN",
"values",
"with",
"the",
"method",
"provided",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1603-L1635 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.query | def query(self, expr, **kwargs):
"""Query columns of the DataManager with a boolean expression.
Args:
expr: Boolean expression to query the columns with.
Returns:
DataManager containing the rows where the boolean expression is satisfied.
"""
columns = se... | python | def query(self, expr, **kwargs):
"""Query columns of the DataManager with a boolean expression.
Args:
expr: Boolean expression to query the columns with.
Returns:
DataManager containing the rows where the boolean expression is satisfied.
"""
columns = se... | [
"def",
"query",
"(",
"self",
",",
"expr",
",",
"*",
"*",
"kwargs",
")",
":",
"columns",
"=",
"self",
".",
"columns",
"def",
"query_builder",
"(",
"df",
",",
"*",
"*",
"kwargs",
")",
":",
"# This is required because of an Arrow limitation",
"# TODO revisit for ... | Query columns of the DataManager with a boolean expression.
Args:
expr: Boolean expression to query the columns with.
Returns:
DataManager containing the rows where the boolean expression is satisfied. | [
"Query",
"columns",
"of",
"the",
"DataManager",
"with",
"a",
"boolean",
"expression",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1637-L1663 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.rank | def rank(self, **kwargs):
"""Computes numerical rank along axis. Equal values are set to the average.
Returns:
DataManager containing the ranks of the values along an axis.
"""
axis = kwargs.get("axis", 0)
numeric_only = True if axis else kwargs.get("numeric_only", F... | python | def rank(self, **kwargs):
"""Computes numerical rank along axis. Equal values are set to the average.
Returns:
DataManager containing the ranks of the values along an axis.
"""
axis = kwargs.get("axis", 0)
numeric_only = True if axis else kwargs.get("numeric_only", F... | [
"def",
"rank",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"axis",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"numeric_only",
"=",
"True",
"if",
"axis",
"else",
"kwargs",
".",
"get",
"(",
"\"numeric_only\"",
",",
"False",
")",
"... | Computes numerical rank along axis. Equal values are set to the average.
Returns:
DataManager containing the ranks of the values along an axis. | [
"Computes",
"numerical",
"rank",
"along",
"axis",
".",
"Equal",
"values",
"are",
"set",
"to",
"the",
"average",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1665-L1682 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.sort_index | def sort_index(self, **kwargs):
"""Sorts the data with respect to either the columns or the indices.
Returns:
DataManager containing the data sorted by columns or indices.
"""
axis = kwargs.pop("axis", 0)
index = self.columns if axis else self.index
# sort_i... | python | def sort_index(self, **kwargs):
"""Sorts the data with respect to either the columns or the indices.
Returns:
DataManager containing the data sorted by columns or indices.
"""
axis = kwargs.pop("axis", 0)
index = self.columns if axis else self.index
# sort_i... | [
"def",
"sort_index",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"axis",
"=",
"kwargs",
".",
"pop",
"(",
"\"axis\"",
",",
"0",
")",
"index",
"=",
"self",
".",
"columns",
"if",
"axis",
"else",
"self",
".",
"index",
"# sort_index can have ascending be ... | Sorts the data with respect to either the columns or the indices.
Returns:
DataManager containing the data sorted by columns or indices. | [
"Sorts",
"the",
"data",
"with",
"respect",
"to",
"either",
"the",
"columns",
"or",
"the",
"indices",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1684-L1718 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._map_across_full_axis_select_indices | def _map_across_full_axis_select_indices(
self, axis, func, indices, keep_remaining=False
):
"""Maps function to select indices along full axis.
Args:
axis: 0 for columns and 1 for rows.
func: Callable mapping function over the BlockParitions.
indices: in... | python | def _map_across_full_axis_select_indices(
self, axis, func, indices, keep_remaining=False
):
"""Maps function to select indices along full axis.
Args:
axis: 0 for columns and 1 for rows.
func: Callable mapping function over the BlockParitions.
indices: in... | [
"def",
"_map_across_full_axis_select_indices",
"(",
"self",
",",
"axis",
",",
"func",
",",
"indices",
",",
"keep_remaining",
"=",
"False",
")",
":",
"return",
"self",
".",
"data",
".",
"apply_func_to_select_indices_along_full_axis",
"(",
"axis",
",",
"func",
",",
... | Maps function to select indices along full axis.
Args:
axis: 0 for columns and 1 for rows.
func: Callable mapping function over the BlockParitions.
indices: indices along axis to map over.
keep_remaining: True if keep indices where function was not applied.
... | [
"Maps",
"function",
"to",
"select",
"indices",
"along",
"full",
"axis",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1726-L1742 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.quantile_for_list_of_values | def quantile_for_list_of_values(self, **kwargs):
"""Returns Manager containing quantiles along an axis for numeric columns.
Returns:
DataManager containing quantiles of original DataManager along an axis.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("a... | python | def quantile_for_list_of_values(self, **kwargs):
"""Returns Manager containing quantiles along an axis for numeric columns.
Returns:
DataManager containing quantiles of original DataManager along an axis.
"""
if self._is_transposed:
kwargs["axis"] = kwargs.get("a... | [
"def",
"quantile_for_list_of_values",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_is_transposed",
":",
"kwargs",
"[",
"\"axis\"",
"]",
"=",
"kwargs",
".",
"get",
"(",
"\"axis\"",
",",
"0",
")",
"^",
"1",
"return",
"self",
".",
... | Returns Manager containing quantiles along an axis for numeric columns.
Returns:
DataManager containing quantiles of original DataManager along an axis. | [
"Returns",
"Manager",
"containing",
"quantiles",
"along",
"an",
"axis",
"for",
"numeric",
"columns",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1744-L1800 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.tail | def tail(self, n):
"""Returns the last n rows.
Args:
n: Integer containing the number of rows to return.
Returns:
DataManager containing the last n rows of the original DataManager.
"""
# See head for an explanation of the transposed behavior
if ... | python | def tail(self, n):
"""Returns the last n rows.
Args:
n: Integer containing the number of rows to return.
Returns:
DataManager containing the last n rows of the original DataManager.
"""
# See head for an explanation of the transposed behavior
if ... | [
"def",
"tail",
"(",
"self",
",",
"n",
")",
":",
"# See head for an explanation of the transposed behavior",
"if",
"n",
"<",
"0",
":",
"n",
"=",
"max",
"(",
"0",
",",
"len",
"(",
"self",
".",
"index",
")",
"+",
"n",
")",
"if",
"self",
".",
"_is_transpos... | Returns the last n rows.
Args:
n: Integer containing the number of rows to return.
Returns:
DataManager containing the last n rows of the original DataManager. | [
"Returns",
"the",
"last",
"n",
"rows",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1837-L1861 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.front | def front(self, n):
"""Returns the first n columns.
Args:
n: Integer containing the number of columns to return.
Returns:
DataManager containing the first n columns of the original DataManager.
"""
new_dtypes = (
self._dtype_cache if self._dt... | python | def front(self, n):
"""Returns the first n columns.
Args:
n: Integer containing the number of columns to return.
Returns:
DataManager containing the first n columns of the original DataManager.
"""
new_dtypes = (
self._dtype_cache if self._dt... | [
"def",
"front",
"(",
"self",
",",
"n",
")",
":",
"new_dtypes",
"=",
"(",
"self",
".",
"_dtype_cache",
"if",
"self",
".",
"_dtype_cache",
"is",
"None",
"else",
"self",
".",
"_dtype_cache",
"[",
":",
"n",
"]",
")",
"# See head for an explanation of the transpo... | Returns the first n columns.
Args:
n: Integer containing the number of columns to return.
Returns:
DataManager containing the first n columns of the original DataManager. | [
"Returns",
"the",
"first",
"n",
"columns",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1863-L1888 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.getitem_column_array | def getitem_column_array(self, key):
"""Get column data for target labels.
Args:
key: Target labels by which to retrieve data.
Returns:
A new QueryCompiler.
"""
# Convert to list for type checking
numeric_indices = list(self.columns.get_indexer_f... | python | def getitem_column_array(self, key):
"""Get column data for target labels.
Args:
key: Target labels by which to retrieve data.
Returns:
A new QueryCompiler.
"""
# Convert to list for type checking
numeric_indices = list(self.columns.get_indexer_f... | [
"def",
"getitem_column_array",
"(",
"self",
",",
"key",
")",
":",
"# Convert to list for type checking",
"numeric_indices",
"=",
"list",
"(",
"self",
".",
"columns",
".",
"get_indexer_for",
"(",
"key",
")",
")",
"# Internal indices is left blank and the internal",
"# `a... | Get column data for target labels.
Args:
key: Target labels by which to retrieve data.
Returns:
A new QueryCompiler. | [
"Get",
"column",
"data",
"for",
"target",
"labels",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1920-L1944 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.getitem_row_array | def getitem_row_array(self, key):
"""Get row data for target labels.
Args:
key: Target numeric indices by which to retrieve data.
Returns:
A new QueryCompiler.
"""
# Convert to list for type checking
key = list(key)
def getitem(df, inter... | python | def getitem_row_array(self, key):
"""Get row data for target labels.
Args:
key: Target numeric indices by which to retrieve data.
Returns:
A new QueryCompiler.
"""
# Convert to list for type checking
key = list(key)
def getitem(df, inter... | [
"def",
"getitem_row_array",
"(",
"self",
",",
"key",
")",
":",
"# Convert to list for type checking",
"key",
"=",
"list",
"(",
"key",
")",
"def",
"getitem",
"(",
"df",
",",
"internal_indices",
"=",
"[",
"]",
")",
":",
"return",
"df",
".",
"iloc",
"[",
"i... | Get row data for target labels.
Args:
key: Target numeric indices by which to retrieve data.
Returns:
A new QueryCompiler. | [
"Get",
"row",
"data",
"for",
"target",
"labels",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1946-L1967 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.setitem | def setitem(self, axis, key, value):
"""Set the column defined by `key` to the `value` provided.
Args:
key: The column name to set.
value: The value to set the column to.
Returns:
A new QueryCompiler
"""
def setitem(df, internal_indices=[])... | python | def setitem(self, axis, key, value):
"""Set the column defined by `key` to the `value` provided.
Args:
key: The column name to set.
value: The value to set the column to.
Returns:
A new QueryCompiler
"""
def setitem(df, internal_indices=[])... | [
"def",
"setitem",
"(",
"self",
",",
"axis",
",",
"key",
",",
"value",
")",
":",
"def",
"setitem",
"(",
"df",
",",
"internal_indices",
"=",
"[",
"]",
")",
":",
"def",
"_setitem",
"(",
")",
":",
"if",
"len",
"(",
"internal_indices",
")",
"==",
"1",
... | Set the column defined by `key` to the `value` provided.
Args:
key: The column name to set.
value: The value to set the column to.
Returns:
A new QueryCompiler | [
"Set",
"the",
"column",
"defined",
"by",
"key",
"to",
"the",
"value",
"provided",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L1969-L2014 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.drop | def drop(self, index=None, columns=None):
"""Remove row data for target index and columns.
Args:
index: Target index to drop.
columns: Target columns to drop.
Returns:
A new QueryCompiler.
"""
if self._is_transposed:
return self.t... | python | def drop(self, index=None, columns=None):
"""Remove row data for target index and columns.
Args:
index: Target index to drop.
columns: Target columns to drop.
Returns:
A new QueryCompiler.
"""
if self._is_transposed:
return self.t... | [
"def",
"drop",
"(",
"self",
",",
"index",
"=",
"None",
",",
"columns",
"=",
"None",
")",
":",
"if",
"self",
".",
"_is_transposed",
":",
"return",
"self",
".",
"transpose",
"(",
")",
".",
"drop",
"(",
"index",
"=",
"columns",
",",
"columns",
"=",
"i... | Remove row data for target index and columns.
Args:
index: Target index to drop.
columns: Target columns to drop.
Returns:
A new QueryCompiler. | [
"Remove",
"row",
"data",
"for",
"target",
"index",
"and",
"columns",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L2020-L2062 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.insert | def insert(self, loc, column, value):
"""Insert new column data.
Args:
loc: Insertion index.
column: Column labels to insert.
value: Dtype object values to insert.
Returns:
A new PandasQueryCompiler with new data inserted.
"""
if ... | python | def insert(self, loc, column, value):
"""Insert new column data.
Args:
loc: Insertion index.
column: Column labels to insert.
value: Dtype object values to insert.
Returns:
A new PandasQueryCompiler with new data inserted.
"""
if ... | [
"def",
"insert",
"(",
"self",
",",
"loc",
",",
"column",
",",
"value",
")",
":",
"if",
"is_list_like",
"(",
"value",
")",
":",
"# TODO make work with another querycompiler object as `value`.",
"# This will require aligning the indices with a `reindex` and ensuring that",
"# t... | Insert new column data.
Args:
loc: Insertion index.
column: Column labels to insert.
value: Dtype object values to insert.
Returns:
A new PandasQueryCompiler with new data inserted. | [
"Insert",
"new",
"column",
"data",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L2071-L2103 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.apply | def apply(self, func, axis, *args, **kwargs):
"""Apply func across given axis.
Args:
func: The function to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler.
"""
if callable(func):
return sel... | python | def apply(self, func, axis, *args, **kwargs):
"""Apply func across given axis.
Args:
func: The function to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler.
"""
if callable(func):
return sel... | [
"def",
"apply",
"(",
"self",
",",
"func",
",",
"axis",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"callable",
"(",
"func",
")",
":",
"return",
"self",
".",
"_callable_func",
"(",
"func",
",",
"axis",
",",
"*",
"args",
",",
"*",
... | Apply func across given axis.
Args:
func: The function to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler. | [
"Apply",
"func",
"across",
"given",
"axis",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L2110-L2127 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._post_process_apply | def _post_process_apply(self, result_data, axis, try_scale=True):
"""Recompute the index after applying function.
Args:
result_data: a BaseFrameManager object.
axis: Target axis along which function was applied.
Returns:
A new PandasQueryCompiler.
""... | python | def _post_process_apply(self, result_data, axis, try_scale=True):
"""Recompute the index after applying function.
Args:
result_data: a BaseFrameManager object.
axis: Target axis along which function was applied.
Returns:
A new PandasQueryCompiler.
""... | [
"def",
"_post_process_apply",
"(",
"self",
",",
"result_data",
",",
"axis",
",",
"try_scale",
"=",
"True",
")",
":",
"if",
"try_scale",
":",
"try",
":",
"internal_index",
"=",
"self",
".",
"compute_index",
"(",
"0",
",",
"result_data",
",",
"True",
")",
... | Recompute the index after applying function.
Args:
result_data: a BaseFrameManager object.
axis: Target axis along which function was applied.
Returns:
A new PandasQueryCompiler. | [
"Recompute",
"the",
"index",
"after",
"applying",
"function",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L2129-L2168 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._dict_func | def _dict_func(self, func, axis, *args, **kwargs):
"""Apply function to certain indices across given axis.
Args:
func: The function to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler.
"""
if "axis" not... | python | def _dict_func(self, func, axis, *args, **kwargs):
"""Apply function to certain indices across given axis.
Args:
func: The function to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler.
"""
if "axis" not... | [
"def",
"_dict_func",
"(",
"self",
",",
"func",
",",
"axis",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"\"axis\"",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"\"axis\"",
"]",
"=",
"axis",
"if",
"axis",
"==",
"0",
":",
"index",
"="... | Apply function to certain indices across given axis.
Args:
func: The function to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler. | [
"Apply",
"function",
"to",
"certain",
"indices",
"across",
"given",
"axis",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L2170-L2198 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._list_like_func | def _list_like_func(self, func, axis, *args, **kwargs):
"""Apply list-like function across given axis.
Args:
func: The function to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler.
"""
func_prepared = s... | python | def _list_like_func(self, func, axis, *args, **kwargs):
"""Apply list-like function across given axis.
Args:
func: The function to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler.
"""
func_prepared = s... | [
"def",
"_list_like_func",
"(",
"self",
",",
"func",
",",
"axis",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"func_prepared",
"=",
"self",
".",
"_prepare_method",
"(",
"lambda",
"df",
":",
"pandas",
".",
"DataFrame",
"(",
"df",
".",
"apply",
... | Apply list-like function across given axis.
Args:
func: The function to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler. | [
"Apply",
"list",
"-",
"like",
"function",
"across",
"given",
"axis",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L2200-L2225 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._callable_func | def _callable_func(self, func, axis, *args, **kwargs):
"""Apply callable functions across given axis.
Args:
func: The functions to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler.
"""
def callable_app... | python | def _callable_func(self, func, axis, *args, **kwargs):
"""Apply callable functions across given axis.
Args:
func: The functions to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler.
"""
def callable_app... | [
"def",
"_callable_func",
"(",
"self",
",",
"func",
",",
"axis",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"callable_apply_builder",
"(",
"df",
",",
"axis",
"=",
"0",
")",
":",
"if",
"not",
"axis",
":",
"df",
".",
"index",
"=",
"... | Apply callable functions across given axis.
Args:
func: The functions to apply.
axis: Target axis to apply the function along.
Returns:
A new PandasQueryCompiler. | [
"Apply",
"callable",
"functions",
"across",
"given",
"axis",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L2227-L2251 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler._manual_repartition | def _manual_repartition(self, axis, repartition_func, **kwargs):
"""This method applies all manual partitioning functions.
Args:
axis: The axis to shuffle data along.
repartition_func: The function used to repartition data.
Returns:
A `BaseFrameManager` obje... | python | def _manual_repartition(self, axis, repartition_func, **kwargs):
"""This method applies all manual partitioning functions.
Args:
axis: The axis to shuffle data along.
repartition_func: The function used to repartition data.
Returns:
A `BaseFrameManager` obje... | [
"def",
"_manual_repartition",
"(",
"self",
",",
"axis",
",",
"repartition_func",
",",
"*",
"*",
"kwargs",
")",
":",
"func",
"=",
"self",
".",
"_prepare_method",
"(",
"repartition_func",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"data",
".",
"m... | This method applies all manual partitioning functions.
Args:
axis: The axis to shuffle data along.
repartition_func: The function used to repartition data.
Returns:
A `BaseFrameManager` object. | [
"This",
"method",
"applies",
"all",
"manual",
"partitioning",
"functions",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L2259-L2270 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.get_dummies | def get_dummies(self, columns, **kwargs):
"""Convert categorical variables to dummy variables for certain columns.
Args:
columns: The columns to convert.
Returns:
A new QueryCompiler.
"""
cls = type(self)
# `columns` as None does not mean all col... | python | def get_dummies(self, columns, **kwargs):
"""Convert categorical variables to dummy variables for certain columns.
Args:
columns: The columns to convert.
Returns:
A new QueryCompiler.
"""
cls = type(self)
# `columns` as None does not mean all col... | [
"def",
"get_dummies",
"(",
"self",
",",
"columns",
",",
"*",
"*",
"kwargs",
")",
":",
"cls",
"=",
"type",
"(",
"self",
")",
"# `columns` as None does not mean all columns, by default it means only",
"# non-numeric columns.",
"if",
"columns",
"is",
"None",
":",
"colu... | Convert categorical variables to dummy variables for certain columns.
Args:
columns: The columns to convert.
Returns:
A new QueryCompiler. | [
"Convert",
"categorical",
"variables",
"to",
"dummy",
"variables",
"for",
"certain",
"columns",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L2327-L2402 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompiler.global_idx_to_numeric_idx | def global_idx_to_numeric_idx(self, axis, indices):
"""
Note: this function involves making copies of the index in memory.
Args:
axis: Axis to extract indices.
indices: Indices to convert to numerical.
Returns:
An Index object.
"""
as... | python | def global_idx_to_numeric_idx(self, axis, indices):
"""
Note: this function involves making copies of the index in memory.
Args:
axis: Axis to extract indices.
indices: Indices to convert to numerical.
Returns:
An Index object.
"""
as... | [
"def",
"global_idx_to_numeric_idx",
"(",
"self",
",",
"axis",
",",
"indices",
")",
":",
"assert",
"axis",
"in",
"[",
"\"row\"",
",",
"\"col\"",
",",
"\"columns\"",
"]",
"if",
"axis",
"==",
"\"row\"",
":",
"return",
"pandas",
".",
"Index",
"(",
"pandas",
... | Note: this function involves making copies of the index in memory.
Args:
axis: Axis to extract indices.
indices: Indices to convert to numerical.
Returns:
An Index object. | [
"Note",
":",
"this",
"function",
"involves",
"making",
"copies",
"of",
"the",
"index",
"in",
"memory",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L2442-L2465 | train |
modin-project/modin | modin/backends/pandas/query_compiler.py | PandasQueryCompilerView._get_data | def _get_data(self) -> BaseFrameManager:
"""Perform the map step
Returns:
A BaseFrameManager object.
"""
def iloc(partition, row_internal_indices, col_internal_indices):
return partition.iloc[row_internal_indices, col_internal_indices]
masked_data = sel... | python | def _get_data(self) -> BaseFrameManager:
"""Perform the map step
Returns:
A BaseFrameManager object.
"""
def iloc(partition, row_internal_indices, col_internal_indices):
return partition.iloc[row_internal_indices, col_internal_indices]
masked_data = sel... | [
"def",
"_get_data",
"(",
"self",
")",
"->",
"BaseFrameManager",
":",
"def",
"iloc",
"(",
"partition",
",",
"row_internal_indices",
",",
"col_internal_indices",
")",
":",
"return",
"partition",
".",
"iloc",
"[",
"row_internal_indices",
",",
"col_internal_indices",
... | Perform the map step
Returns:
A BaseFrameManager object. | [
"Perform",
"the",
"map",
"step"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/backends/pandas/query_compiler.py#L2528-L2545 | train |
modin-project/modin | modin/engines/python/pandas_on_python/frame/partition_manager.py | PythonFrameManager.block_lengths | def block_lengths(self):
"""Gets the lengths of the blocks.
Note: This works with the property structure `_lengths_cache` to avoid
having to recompute these values each time they are needed.
"""
if self._lengths_cache is None:
# The first column will have the cor... | python | def block_lengths(self):
"""Gets the lengths of the blocks.
Note: This works with the property structure `_lengths_cache` to avoid
having to recompute these values each time they are needed.
"""
if self._lengths_cache is None:
# The first column will have the cor... | [
"def",
"block_lengths",
"(",
"self",
")",
":",
"if",
"self",
".",
"_lengths_cache",
"is",
"None",
":",
"# The first column will have the correct lengths. We have an",
"# invariant that requires that all blocks be the same length in a",
"# row of blocks.",
"self",
".",
"_lengths_c... | Gets the lengths of the blocks.
Note: This works with the property structure `_lengths_cache` to avoid
having to recompute these values each time they are needed. | [
"Gets",
"the",
"lengths",
"of",
"the",
"blocks",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/python/pandas_on_python/frame/partition_manager.py#L29-L44 | train |
modin-project/modin | modin/engines/python/pandas_on_python/frame/partition_manager.py | PythonFrameManager.block_widths | def block_widths(self):
"""Gets the widths of the blocks.
Note: This works with the property structure `_widths_cache` to avoid
having to recompute these values each time they are needed.
"""
if self._widths_cache is None:
# The first column will have the correct... | python | def block_widths(self):
"""Gets the widths of the blocks.
Note: This works with the property structure `_widths_cache` to avoid
having to recompute these values each time they are needed.
"""
if self._widths_cache is None:
# The first column will have the correct... | [
"def",
"block_widths",
"(",
"self",
")",
":",
"if",
"self",
".",
"_widths_cache",
"is",
"None",
":",
"# The first column will have the correct lengths. We have an",
"# invariant that requires that all blocks be the same width in a",
"# column of blocks.",
"self",
".",
"_widths_ca... | Gets the widths of the blocks.
Note: This works with the property structure `_widths_cache` to avoid
having to recompute these values each time they are needed. | [
"Gets",
"the",
"widths",
"of",
"the",
"blocks",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/python/pandas_on_python/frame/partition_manager.py#L47-L62 | train |
modin-project/modin | modin/pandas/base.py | BasePandasDataset._update_inplace | def _update_inplace(self, new_query_compiler):
"""Updates the current DataFrame inplace.
Args:
new_query_compiler: The new QueryCompiler to use to manage the data
"""
old_query_compiler = self._query_compiler
self._query_compiler = new_query_compiler
... | python | def _update_inplace(self, new_query_compiler):
"""Updates the current DataFrame inplace.
Args:
new_query_compiler: The new QueryCompiler to use to manage the data
"""
old_query_compiler = self._query_compiler
self._query_compiler = new_query_compiler
... | [
"def",
"_update_inplace",
"(",
"self",
",",
"new_query_compiler",
")",
":",
"old_query_compiler",
"=",
"self",
".",
"_query_compiler",
"self",
".",
"_query_compiler",
"=",
"new_query_compiler",
"old_query_compiler",
".",
"free",
"(",
")"
] | Updates the current DataFrame inplace.
Args:
new_query_compiler: The new QueryCompiler to use to manage the data | [
"Updates",
"the",
"current",
"DataFrame",
"inplace",
".",
"Args",
":",
"new_query_compiler",
":",
"The",
"new",
"QueryCompiler",
"to",
"use",
"to",
"manage",
"the",
"data"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/base.py#L74-L82 | train |
modin-project/modin | modin/pandas/base.py | BasePandasDataset._validate_other | def _validate_other(
self,
other,
axis,
numeric_only=False,
numeric_or_time_only=False,
numeric_or_object_only=False,
comparison_dtypes_only=False,
):
"""Helper method to check validity of other in inter-df operations"""
axis = self._... | python | def _validate_other(
self,
other,
axis,
numeric_only=False,
numeric_or_time_only=False,
numeric_or_object_only=False,
comparison_dtypes_only=False,
):
"""Helper method to check validity of other in inter-df operations"""
axis = self._... | [
"def",
"_validate_other",
"(",
"self",
",",
"other",
",",
"axis",
",",
"numeric_only",
"=",
"False",
",",
"numeric_or_time_only",
"=",
"False",
",",
"numeric_or_object_only",
"=",
"False",
",",
"comparison_dtypes_only",
"=",
"False",
",",
")",
":",
"axis",
"="... | Helper method to check validity of other in inter-df operations | [
"Helper",
"method",
"to",
"check",
"validity",
"of",
"other",
"in",
"inter",
"-",
"df",
"operations"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/base.py#L84-L165 | train |
modin-project/modin | modin/pandas/base.py | BasePandasDataset._default_to_pandas | def _default_to_pandas(self, op, *args, **kwargs):
"""Helper method to use default pandas function"""
empty_self_str = "" if not self.empty else " for empty DataFrame"
ErrorMessage.default_to_pandas(
"`{}.{}`{}".format(
self.__name__,
op if isins... | python | def _default_to_pandas(self, op, *args, **kwargs):
"""Helper method to use default pandas function"""
empty_self_str = "" if not self.empty else " for empty DataFrame"
ErrorMessage.default_to_pandas(
"`{}.{}`{}".format(
self.__name__,
op if isins... | [
"def",
"_default_to_pandas",
"(",
"self",
",",
"op",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"empty_self_str",
"=",
"\"\"",
"if",
"not",
"self",
".",
"empty",
"else",
"\" for empty DataFrame\"",
"ErrorMessage",
".",
"default_to_pandas",
"(",
"\"... | Helper method to use default pandas function | [
"Helper",
"method",
"to",
"use",
"default",
"pandas",
"function"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/base.py#L181-L234 | train |
modin-project/modin | modin/pandas/base.py | BasePandasDataset.abs | def abs(self):
"""Apply an absolute value function to all numeric columns.
Returns:
A new DataFrame with the applied absolute value.
"""
self._validate_dtypes(numeric_only=True)
return self.__constructor__(query_compiler=self._query_compiler.abs()) | python | def abs(self):
"""Apply an absolute value function to all numeric columns.
Returns:
A new DataFrame with the applied absolute value.
"""
self._validate_dtypes(numeric_only=True)
return self.__constructor__(query_compiler=self._query_compiler.abs()) | [
"def",
"abs",
"(",
"self",
")",
":",
"self",
".",
"_validate_dtypes",
"(",
"numeric_only",
"=",
"True",
")",
"return",
"self",
".",
"__constructor__",
"(",
"query_compiler",
"=",
"self",
".",
"_query_compiler",
".",
"abs",
"(",
")",
")"
] | Apply an absolute value function to all numeric columns.
Returns:
A new DataFrame with the applied absolute value. | [
"Apply",
"an",
"absolute",
"value",
"function",
"to",
"all",
"numeric",
"columns",
".",
"Returns",
":",
"A",
"new",
"DataFrame",
"with",
"the",
"applied",
"absolute",
"value",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/base.py#L246-L253 | train |
modin-project/modin | modin/pandas/base.py | BasePandasDataset.add | def add(self, other, axis="columns", level=None, fill_value=None):
"""Add this DataFrame to another or a scalar/list.
Args:
other: What to add this this DataFrame.
axis: The axis to apply addition over. Only applicaable to Series
or list 'other'.
... | python | def add(self, other, axis="columns", level=None, fill_value=None):
"""Add this DataFrame to another or a scalar/list.
Args:
other: What to add this this DataFrame.
axis: The axis to apply addition over. Only applicaable to Series
or list 'other'.
... | [
"def",
"add",
"(",
"self",
",",
"other",
",",
"axis",
"=",
"\"columns\"",
",",
"level",
"=",
"None",
",",
"fill_value",
"=",
"None",
")",
":",
"return",
"self",
".",
"_binary_op",
"(",
"\"add\"",
",",
"other",
",",
"axis",
"=",
"axis",
",",
"level",
... | Add this DataFrame to another or a scalar/list.
Args:
other: What to add this this DataFrame.
axis: The axis to apply addition over. Only applicaable to Series
or list 'other'.
level: A level in the multilevel axis to add over.
fill_value: ... | [
"Add",
"this",
"DataFrame",
"to",
"another",
"or",
"a",
"scalar",
"/",
"list",
".",
"Args",
":",
"other",
":",
"What",
"to",
"add",
"this",
"this",
"DataFrame",
".",
"axis",
":",
"The",
"axis",
"to",
"apply",
"addition",
"over",
".",
"Only",
"applicaab... | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/base.py#L273-L288 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.