id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
27,400 | 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 |
27,401 | 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 |
27,402 | 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 |
27,403 | 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 |
27,404 | 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 |
27,405 | 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 |
27,406 | 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 |
27,407 | 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 |
27,408 | 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 |
27,409 | 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 |
27,410 | 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 |
27,411 | 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 |
27,412 | 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 |
27,413 | 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 |
27,414 | 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 |
27,415 | 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 |
27,416 | 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 |
27,417 | 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 |
27,418 | 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 |
27,419 | 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 |
27,420 | 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 |
27,421 | 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 |
27,422 | 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 |
27,423 | 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 |
27,424 | 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 |
27,425 | 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 |
27,426 | 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 |
27,427 | 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 |
27,428 | 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 |
27,429 | 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 |
27,430 | 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 |
27,431 | 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 |
27,432 | 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 |
27,433 | 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 |
27,434 | 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 |
27,435 | 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 |
27,436 | 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 |
27,437 | 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 |
27,438 | 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 |
27,439 | 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 |
27,440 | 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 |
27,441 | 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 |
27,442 | 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 |
27,443 | 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 |
27,444 | 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 |
27,445 | 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 |
27,446 | 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 |
27,447 | 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 |
27,448 | 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 |
27,449 | 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 |
27,450 | 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 |
27,451 | 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 |
27,452 | 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 |
27,453 | 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 |
27,454 | 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 |
27,455 | 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 |
27,456 | 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 |
27,457 | 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 |
27,458 | modin-project/modin | modin/pandas/base.py | BasePandasDataset.bool | def bool(self):
"""Return the bool of a single element PandasObject.
This must be a boolean scalar value, either True or False. Raise a
ValueError if the PandasObject does not have exactly 1 element, or that
element is not boolean
"""
shape = self.shape
... | python | def bool(self):
"""Return the bool of a single element PandasObject.
This must be a boolean scalar value, either True or False. Raise a
ValueError if the PandasObject does not have exactly 1 element, or that
element is not boolean
"""
shape = self.shape
... | [
"def",
"bool",
"(",
"self",
")",
":",
"shape",
"=",
"self",
".",
"shape",
"if",
"shape",
"!=",
"(",
"1",
",",
")",
"and",
"shape",
"!=",
"(",
"1",
",",
"1",
")",
":",
"raise",
"ValueError",
"(",
"\"\"\"The PandasObject does not have exactly\r\n ... | Return the bool of a single element PandasObject.
This must be a boolean scalar value, either True or False. Raise a
ValueError if the PandasObject does not have exactly 1 element, or that
element is not boolean | [
"Return",
"the",
"bool",
"of",
"a",
"single",
"element",
"PandasObject",
".",
"This",
"must",
"be",
"a",
"boolean",
"scalar",
"value",
"either",
"True",
"or",
"False",
".",
"Raise",
"a",
"ValueError",
"if",
"the",
"PandasObject",
"does",
"not",
"have",
"ex... | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/base.py#L583-L600 |
27,459 | modin-project/modin | modin/engines/python/pandas_on_python/frame/partition.py | PandasOnPythonFramePartition.get | def get(self):
"""Flushes the call_queue and returns the data.
Note: Since this object is a simple wrapper, just return the data.
Returns:
The object that was `put`.
"""
if self.call_queue:
return self.apply(lambda df: df).data
else:
... | python | def get(self):
"""Flushes the call_queue and returns the data.
Note: Since this object is a simple wrapper, just return the data.
Returns:
The object that was `put`.
"""
if self.call_queue:
return self.apply(lambda df: df).data
else:
... | [
"def",
"get",
"(",
"self",
")",
":",
"if",
"self",
".",
"call_queue",
":",
"return",
"self",
".",
"apply",
"(",
"lambda",
"df",
":",
"df",
")",
".",
"data",
"else",
":",
"return",
"self",
".",
"data",
".",
"copy",
"(",
")"
] | Flushes the call_queue and returns the data.
Note: Since this object is a simple wrapper, just return the data.
Returns:
The object that was `put`. | [
"Flushes",
"the",
"call_queue",
"and",
"returns",
"the",
"data",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/python/pandas_on_python/frame/partition.py#L23-L34 |
27,460 | modin-project/modin | modin/engines/dask/pandas_on_dask_delayed/frame/partition.py | DaskFramePartition.add_to_apply_calls | def add_to_apply_calls(self, func, **kwargs):
"""Add the function to the apply function call stack.
This function will be executed when apply is called. It will be executed
in the order inserted; apply's func operates the last and return
"""
import dask
self.delayed_cal... | python | def add_to_apply_calls(self, func, **kwargs):
"""Add the function to the apply function call stack.
This function will be executed when apply is called. It will be executed
in the order inserted; apply's func operates the last and return
"""
import dask
self.delayed_cal... | [
"def",
"add_to_apply_calls",
"(",
"self",
",",
"func",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"dask",
"self",
".",
"delayed_call",
"=",
"dask",
".",
"delayed",
"(",
"func",
")",
"(",
"self",
".",
"delayed_call",
",",
"*",
"*",
"kwargs",
")",
"r... | Add the function to the apply function call stack.
This function will be executed when apply is called. It will be executed
in the order inserted; apply's func operates the last and return | [
"Add",
"the",
"function",
"to",
"the",
"apply",
"function",
"call",
"stack",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/dask/pandas_on_dask_delayed/frame/partition.py#L50-L59 |
27,461 | modin-project/modin | modin/data_management/utils.py | _get_nan_block_id | def _get_nan_block_id(partition_class, n_row=1, n_col=1, transpose=False):
"""A memory efficient way to get a block of NaNs.
Args:
partition_class (BaseFramePartition): The class to use to put the object
in the remote format.
n_row(int): The number of rows.
n_col(int): The n... | python | def _get_nan_block_id(partition_class, n_row=1, n_col=1, transpose=False):
"""A memory efficient way to get a block of NaNs.
Args:
partition_class (BaseFramePartition): The class to use to put the object
in the remote format.
n_row(int): The number of rows.
n_col(int): The n... | [
"def",
"_get_nan_block_id",
"(",
"partition_class",
",",
"n_row",
"=",
"1",
",",
"n_col",
"=",
"1",
",",
"transpose",
"=",
"False",
")",
":",
"global",
"_NAN_BLOCKS",
"if",
"transpose",
":",
"n_row",
",",
"n_col",
"=",
"n_col",
",",
"n_row",
"shape",
"="... | A memory efficient way to get a block of NaNs.
Args:
partition_class (BaseFramePartition): The class to use to put the object
in the remote format.
n_row(int): The number of rows.
n_col(int): The number of columns.
transpose(bool): If true, swap rows and columns.
Ret... | [
"A",
"memory",
"efficient",
"way",
"to",
"get",
"a",
"block",
"of",
"NaNs",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/data_management/utils.py#L55-L75 |
27,462 | modin-project/modin | modin/data_management/utils.py | split_result_of_axis_func_pandas | def split_result_of_axis_func_pandas(axis, num_splits, result, length_list=None):
"""Split the Pandas result evenly based on the provided number of splits.
Args:
axis: The axis to split across.
num_splits: The number of even splits to create.
result: The result of the computation. This ... | python | def split_result_of_axis_func_pandas(axis, num_splits, result, length_list=None):
"""Split the Pandas result evenly based on the provided number of splits.
Args:
axis: The axis to split across.
num_splits: The number of even splits to create.
result: The result of the computation. This ... | [
"def",
"split_result_of_axis_func_pandas",
"(",
"axis",
",",
"num_splits",
",",
"result",
",",
"length_list",
"=",
"None",
")",
":",
"if",
"num_splits",
"==",
"1",
":",
"return",
"result",
"if",
"length_list",
"is",
"not",
"None",
":",
"length_list",
".",
"i... | Split the Pandas result evenly based on the provided number of splits.
Args:
axis: The axis to split across.
num_splits: The number of even splits to create.
result: The result of the computation. This should be a Pandas
DataFrame.
length_list: The list of lengths to spl... | [
"Split",
"the",
"Pandas",
"result",
"evenly",
"based",
"on",
"the",
"provided",
"number",
"of",
"splits",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/data_management/utils.py#L78-L111 |
27,463 | modin-project/modin | modin/pandas/indexing.py | _parse_tuple | def _parse_tuple(tup):
"""Unpack the user input for getitem and setitem and compute ndim
loc[a] -> ([a], :), 1D
loc[[a,b],] -> ([a,b], :),
loc[a,b] -> ([a], [b]), 0D
"""
row_loc, col_loc = slice(None), slice(None)
if is_tuple(tup):
row_loc = tup[0]
if len(tup) == 2:
... | python | def _parse_tuple(tup):
"""Unpack the user input for getitem and setitem and compute ndim
loc[a] -> ([a], :), 1D
loc[[a,b],] -> ([a,b], :),
loc[a,b] -> ([a], [b]), 0D
"""
row_loc, col_loc = slice(None), slice(None)
if is_tuple(tup):
row_loc = tup[0]
if len(tup) == 2:
... | [
"def",
"_parse_tuple",
"(",
"tup",
")",
":",
"row_loc",
",",
"col_loc",
"=",
"slice",
"(",
"None",
")",
",",
"slice",
"(",
"None",
")",
"if",
"is_tuple",
"(",
"tup",
")",
":",
"row_loc",
"=",
"tup",
"[",
"0",
"]",
"if",
"len",
"(",
"tup",
")",
... | Unpack the user input for getitem and setitem and compute ndim
loc[a] -> ([a], :), 1D
loc[[a,b],] -> ([a,b], :),
loc[a,b] -> ([a], [b]), 0D | [
"Unpack",
"the",
"user",
"input",
"for",
"getitem",
"and",
"setitem",
"and",
"compute",
"ndim"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/indexing.py#L77-L101 |
27,464 | modin-project/modin | modin/pandas/indexing.py | _is_enlargement | def _is_enlargement(locator, global_index):
"""Determine if a locator will enlarge the global index.
Enlargement happens when you trying to locate using labels isn't in the
original index. In other words, enlargement == adding NaNs !
"""
if (
is_list_like(locator)
and not is_slice(l... | python | def _is_enlargement(locator, global_index):
"""Determine if a locator will enlarge the global index.
Enlargement happens when you trying to locate using labels isn't in the
original index. In other words, enlargement == adding NaNs !
"""
if (
is_list_like(locator)
and not is_slice(l... | [
"def",
"_is_enlargement",
"(",
"locator",
",",
"global_index",
")",
":",
"if",
"(",
"is_list_like",
"(",
"locator",
")",
"and",
"not",
"is_slice",
"(",
"locator",
")",
"and",
"len",
"(",
"locator",
")",
">",
"0",
"and",
"not",
"is_boolean_array",
"(",
"l... | Determine if a locator will enlarge the global index.
Enlargement happens when you trying to locate using labels isn't in the
original index. In other words, enlargement == adding NaNs ! | [
"Determine",
"if",
"a",
"locator",
"will",
"enlarge",
"the",
"global",
"index",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/indexing.py#L104-L120 |
27,465 | modin-project/modin | modin/pandas/indexing.py | _compute_ndim | def _compute_ndim(row_loc, col_loc):
"""Compute the ndim of result from locators
"""
row_scaler = is_scalar(row_loc)
col_scaler = is_scalar(col_loc)
if row_scaler and col_scaler:
ndim = 0
elif row_scaler ^ col_scaler:
ndim = 1
else:
ndim = 2
return ndim | python | def _compute_ndim(row_loc, col_loc):
"""Compute the ndim of result from locators
"""
row_scaler = is_scalar(row_loc)
col_scaler = is_scalar(col_loc)
if row_scaler and col_scaler:
ndim = 0
elif row_scaler ^ col_scaler:
ndim = 1
else:
ndim = 2
return ndim | [
"def",
"_compute_ndim",
"(",
"row_loc",
",",
"col_loc",
")",
":",
"row_scaler",
"=",
"is_scalar",
"(",
"row_loc",
")",
"col_scaler",
"=",
"is_scalar",
"(",
"col_loc",
")",
"if",
"row_scaler",
"and",
"col_scaler",
":",
"ndim",
"=",
"0",
"elif",
"row_scaler",
... | Compute the ndim of result from locators | [
"Compute",
"the",
"ndim",
"of",
"result",
"from",
"locators"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/indexing.py#L127-L140 |
27,466 | modin-project/modin | modin/pandas/indexing.py | _LocationIndexerBase._broadcast_item | def _broadcast_item(self, row_lookup, col_lookup, item, to_shape):
"""Use numpy to broadcast or reshape item.
Notes:
- Numpy is memory efficient, there shouldn't be performance issue.
"""
# It is valid to pass a DataFrame or Series to __setitem__ that is larger than
... | python | def _broadcast_item(self, row_lookup, col_lookup, item, to_shape):
"""Use numpy to broadcast or reshape item.
Notes:
- Numpy is memory efficient, there shouldn't be performance issue.
"""
# It is valid to pass a DataFrame or Series to __setitem__ that is larger than
... | [
"def",
"_broadcast_item",
"(",
"self",
",",
"row_lookup",
",",
"col_lookup",
",",
"item",
",",
"to_shape",
")",
":",
"# It is valid to pass a DataFrame or Series to __setitem__ that is larger than",
"# the target the user is trying to overwrite. This",
"if",
"isinstance",
"(",
... | Use numpy to broadcast or reshape item.
Notes:
- Numpy is memory efficient, there shouldn't be performance issue. | [
"Use",
"numpy",
"to",
"broadcast",
"or",
"reshape",
"item",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/indexing.py#L187-L221 |
27,467 | modin-project/modin | modin/pandas/indexing.py | _LocationIndexerBase._write_items | def _write_items(self, row_lookup, col_lookup, item):
"""Perform remote write and replace blocks.
"""
self.qc.write_items(row_lookup, col_lookup, item) | python | def _write_items(self, row_lookup, col_lookup, item):
"""Perform remote write and replace blocks.
"""
self.qc.write_items(row_lookup, col_lookup, item) | [
"def",
"_write_items",
"(",
"self",
",",
"row_lookup",
",",
"col_lookup",
",",
"item",
")",
":",
"self",
".",
"qc",
".",
"write_items",
"(",
"row_lookup",
",",
"col_lookup",
",",
"item",
")"
] | Perform remote write and replace blocks. | [
"Perform",
"remote",
"write",
"and",
"replace",
"blocks",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/indexing.py#L223-L226 |
27,468 | modin-project/modin | modin/pandas/indexing.py | _LocIndexer._compute_enlarge_labels | def _compute_enlarge_labels(self, locator, base_index):
"""Helper for _enlarge_axis, compute common labels and extra labels.
Returns:
nan_labels: The labels needs to be added
"""
# base_index_type can be pd.Index or pd.DatetimeIndex
# depending on user input and pan... | python | def _compute_enlarge_labels(self, locator, base_index):
"""Helper for _enlarge_axis, compute common labels and extra labels.
Returns:
nan_labels: The labels needs to be added
"""
# base_index_type can be pd.Index or pd.DatetimeIndex
# depending on user input and pan... | [
"def",
"_compute_enlarge_labels",
"(",
"self",
",",
"locator",
",",
"base_index",
")",
":",
"# base_index_type can be pd.Index or pd.DatetimeIndex",
"# depending on user input and pandas behavior",
"# See issue #2264",
"base_index_type",
"=",
"type",
"(",
"base_index",
")",
"lo... | Helper for _enlarge_axis, compute common labels and extra labels.
Returns:
nan_labels: The labels needs to be added | [
"Helper",
"for",
"_enlarge_axis",
"compute",
"common",
"labels",
"and",
"extra",
"labels",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/indexing.py#L294-L315 |
27,469 | modin-project/modin | modin/engines/ray/pandas_on_ray/io.py | _split_result_for_readers | def _split_result_for_readers(axis, num_splits, df): # pragma: no cover
"""Splits the DataFrame read into smaller DataFrames and handles all edge cases.
Args:
axis: Which axis to split over.
num_splits: The number of splits to create.
df: The DataFrame after it has been read.
Retu... | python | def _split_result_for_readers(axis, num_splits, df): # pragma: no cover
"""Splits the DataFrame read into smaller DataFrames and handles all edge cases.
Args:
axis: Which axis to split over.
num_splits: The number of splits to create.
df: The DataFrame after it has been read.
Retu... | [
"def",
"_split_result_for_readers",
"(",
"axis",
",",
"num_splits",
",",
"df",
")",
":",
"# pragma: no cover",
"splits",
"=",
"split_result_of_axis_func_pandas",
"(",
"axis",
",",
"num_splits",
",",
"df",
")",
"if",
"not",
"isinstance",
"(",
"splits",
",",
"list... | Splits the DataFrame read into smaller DataFrames and handles all edge cases.
Args:
axis: Which axis to split over.
num_splits: The number of splits to create.
df: The DataFrame after it has been read.
Returns:
A list of pandas DataFrames. | [
"Splits",
"the",
"DataFrame",
"read",
"into",
"smaller",
"DataFrames",
"and",
"handles",
"all",
"edge",
"cases",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/ray/pandas_on_ray/io.py#L18-L32 |
27,470 | modin-project/modin | modin/engines/ray/pandas_on_ray/io.py | _read_parquet_columns | def _read_parquet_columns(path, columns, num_splits, kwargs): # pragma: no cover
"""Use a Ray task to read columns from Parquet into a Pandas DataFrame.
Note: Ray functions are not detected by codecov (thus pragma: no cover)
Args:
path: The path of the Parquet file.
columns: The list of c... | python | def _read_parquet_columns(path, columns, num_splits, kwargs): # pragma: no cover
"""Use a Ray task to read columns from Parquet into a Pandas DataFrame.
Note: Ray functions are not detected by codecov (thus pragma: no cover)
Args:
path: The path of the Parquet file.
columns: The list of c... | [
"def",
"_read_parquet_columns",
"(",
"path",
",",
"columns",
",",
"num_splits",
",",
"kwargs",
")",
":",
"# pragma: no cover",
"import",
"pyarrow",
".",
"parquet",
"as",
"pq",
"df",
"=",
"pq",
".",
"read_pandas",
"(",
"path",
",",
"columns",
"=",
"columns",
... | Use a Ray task to read columns from Parquet into a Pandas DataFrame.
Note: Ray functions are not detected by codecov (thus pragma: no cover)
Args:
path: The path of the Parquet file.
columns: The list of column names to read.
num_splits: The number of partitions to split the column int... | [
"Use",
"a",
"Ray",
"task",
"to",
"read",
"columns",
"from",
"Parquet",
"into",
"a",
"Pandas",
"DataFrame",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/ray/pandas_on_ray/io.py#L36-L56 |
27,471 | modin-project/modin | modin/engines/ray/pandas_on_ray/io.py | _read_csv_with_offset_pandas_on_ray | def _read_csv_with_offset_pandas_on_ray(
fname, num_splits, start, end, kwargs, header
): # pragma: no cover
"""Use a Ray task to read a chunk of a CSV into a Pandas DataFrame.
Note: Ray functions are not detected by codecov (thus pragma: no cover)
Args:
fname: The filename of the file to ope... | python | def _read_csv_with_offset_pandas_on_ray(
fname, num_splits, start, end, kwargs, header
): # pragma: no cover
"""Use a Ray task to read a chunk of a CSV into a Pandas DataFrame.
Note: Ray functions are not detected by codecov (thus pragma: no cover)
Args:
fname: The filename of the file to ope... | [
"def",
"_read_csv_with_offset_pandas_on_ray",
"(",
"fname",
",",
"num_splits",
",",
"start",
",",
"end",
",",
"kwargs",
",",
"header",
")",
":",
"# pragma: no cover",
"index_col",
"=",
"kwargs",
".",
"get",
"(",
"\"index_col\"",
",",
"None",
")",
"bio",
"=",
... | Use a Ray task to read a chunk of a CSV into a Pandas DataFrame.
Note: Ray functions are not detected by codecov (thus pragma: no cover)
Args:
fname: The filename of the file to open.
num_splits: The number of splits (partitions) to separate the DataFrame into.
start: The start byte of... | [
"Use",
"a",
"Ray",
"task",
"to",
"read",
"a",
"chunk",
"of",
"a",
"CSV",
"into",
"a",
"Pandas",
"DataFrame",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/ray/pandas_on_ray/io.py#L60-L96 |
27,472 | modin-project/modin | modin/engines/ray/pandas_on_ray/io.py | _read_hdf_columns | def _read_hdf_columns(path_or_buf, columns, num_splits, kwargs): # pragma: no cover
"""Use a Ray task to read columns from HDF5 into a Pandas DataFrame.
Note: Ray functions are not detected by codecov (thus pragma: no cover)
Args:
path_or_buf: The path of the HDF5 file.
columns: The list ... | python | def _read_hdf_columns(path_or_buf, columns, num_splits, kwargs): # pragma: no cover
"""Use a Ray task to read columns from HDF5 into a Pandas DataFrame.
Note: Ray functions are not detected by codecov (thus pragma: no cover)
Args:
path_or_buf: The path of the HDF5 file.
columns: The list ... | [
"def",
"_read_hdf_columns",
"(",
"path_or_buf",
",",
"columns",
",",
"num_splits",
",",
"kwargs",
")",
":",
"# pragma: no cover",
"df",
"=",
"pandas",
".",
"read_hdf",
"(",
"path_or_buf",
",",
"columns",
"=",
"columns",
",",
"*",
"*",
"kwargs",
")",
"# Appen... | Use a Ray task to read columns from HDF5 into a Pandas DataFrame.
Note: Ray functions are not detected by codecov (thus pragma: no cover)
Args:
path_or_buf: The path of the HDF5 file.
columns: The list of column names to read.
num_splits: The number of partitions to split the column in... | [
"Use",
"a",
"Ray",
"task",
"to",
"read",
"columns",
"from",
"HDF5",
"into",
"a",
"Pandas",
"DataFrame",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/ray/pandas_on_ray/io.py#L100-L119 |
27,473 | modin-project/modin | modin/engines/ray/pandas_on_ray/io.py | _read_feather_columns | def _read_feather_columns(path, columns, num_splits): # pragma: no cover
"""Use a Ray task to read columns from Feather into a Pandas DataFrame.
Note: Ray functions are not detected by codecov (thus pragma: no cover)
Args:
path: The path of the Feather file.
columns: The list of column na... | python | def _read_feather_columns(path, columns, num_splits): # pragma: no cover
"""Use a Ray task to read columns from Feather into a Pandas DataFrame.
Note: Ray functions are not detected by codecov (thus pragma: no cover)
Args:
path: The path of the Feather file.
columns: The list of column na... | [
"def",
"_read_feather_columns",
"(",
"path",
",",
"columns",
",",
"num_splits",
")",
":",
"# pragma: no cover",
"from",
"pyarrow",
"import",
"feather",
"df",
"=",
"feather",
".",
"read_feather",
"(",
"path",
",",
"columns",
"=",
"columns",
")",
"# Append the len... | Use a Ray task to read columns from Feather into a Pandas DataFrame.
Note: Ray functions are not detected by codecov (thus pragma: no cover)
Args:
path: The path of the Feather file.
columns: The list of column names to read.
num_splits: The number of partitions to split the column int... | [
"Use",
"a",
"Ray",
"task",
"to",
"read",
"columns",
"from",
"Feather",
"into",
"a",
"Pandas",
"DataFrame",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/ray/pandas_on_ray/io.py#L123-L143 |
27,474 | modin-project/modin | modin/engines/ray/generic/io.py | get_index | def get_index(index_name, *partition_indices): # pragma: no cover
"""Get the index from the indices returned by the workers.
Note: Ray functions are not detected by codecov (thus pragma: no cover)"""
index = partition_indices[0].append(partition_indices[1:])
index.names = index_name
return index | python | def get_index(index_name, *partition_indices): # pragma: no cover
"""Get the index from the indices returned by the workers.
Note: Ray functions are not detected by codecov (thus pragma: no cover)"""
index = partition_indices[0].append(partition_indices[1:])
index.names = index_name
return index | [
"def",
"get_index",
"(",
"index_name",
",",
"*",
"partition_indices",
")",
":",
"# pragma: no cover",
"index",
"=",
"partition_indices",
"[",
"0",
"]",
".",
"append",
"(",
"partition_indices",
"[",
"1",
":",
"]",
")",
"index",
".",
"names",
"=",
"index_name"... | Get the index from the indices returned by the workers.
Note: Ray functions are not detected by codecov (thus pragma: no cover) | [
"Get",
"the",
"index",
"from",
"the",
"indices",
"returned",
"by",
"the",
"workers",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/ray/generic/io.py#L64-L70 |
27,475 | modin-project/modin | modin/engines/ray/generic/io.py | RayIO.read_hdf | def read_hdf(cls, path_or_buf, **kwargs):
"""Load a h5 file from the file path or buffer, returning a DataFrame.
Args:
path_or_buf: string, buffer or path object
Path to the file to open, or an open :class:`pandas.HDFStore` object.
kwargs: Pass into pandas.read_h... | python | def read_hdf(cls, path_or_buf, **kwargs):
"""Load a h5 file from the file path or buffer, returning a DataFrame.
Args:
path_or_buf: string, buffer or path object
Path to the file to open, or an open :class:`pandas.HDFStore` object.
kwargs: Pass into pandas.read_h... | [
"def",
"read_hdf",
"(",
"cls",
",",
"path_or_buf",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"cls",
".",
"read_hdf_remote_task",
"is",
"None",
":",
"return",
"super",
"(",
"RayIO",
",",
"cls",
")",
".",
"read_hdf",
"(",
"path_or_buf",
",",
"*",
"*",
"... | Load a h5 file from the file path or buffer, returning a DataFrame.
Args:
path_or_buf: string, buffer or path object
Path to the file to open, or an open :class:`pandas.HDFStore` object.
kwargs: Pass into pandas.read_hdf function.
Returns:
DataFrame ... | [
"Load",
"a",
"h5",
"file",
"from",
"the",
"file",
"path",
"or",
"buffer",
"returning",
"a",
"DataFrame",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/ray/generic/io.py#L565-L625 |
27,476 | modin-project/modin | modin/engines/ray/generic/io.py | RayIO.read_feather | def read_feather(cls, path, columns=None, use_threads=True):
"""Read a pandas.DataFrame from Feather format.
Ray DataFrame only supports pyarrow engine for now.
Args:
path: The filepath of the feather file.
We only support local files for now.
mu... | python | def read_feather(cls, path, columns=None, use_threads=True):
"""Read a pandas.DataFrame from Feather format.
Ray DataFrame only supports pyarrow engine for now.
Args:
path: The filepath of the feather file.
We only support local files for now.
mu... | [
"def",
"read_feather",
"(",
"cls",
",",
"path",
",",
"columns",
"=",
"None",
",",
"use_threads",
"=",
"True",
")",
":",
"if",
"cls",
".",
"read_feather_remote_task",
"is",
"None",
":",
"return",
"super",
"(",
"RayIO",
",",
"cls",
")",
".",
"read_feather"... | Read a pandas.DataFrame from Feather format.
Ray DataFrame only supports pyarrow engine for now.
Args:
path: The filepath of the feather file.
We only support local files for now.
multi threading is set to True by default
columns: not support... | [
"Read",
"a",
"pandas",
".",
"DataFrame",
"from",
"Feather",
"format",
".",
"Ray",
"DataFrame",
"only",
"supports",
"pyarrow",
"engine",
"for",
"now",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/ray/generic/io.py#L628-L686 |
27,477 | modin-project/modin | modin/pandas/datetimes.py | to_datetime | def to_datetime(
arg,
errors="raise",
dayfirst=False,
yearfirst=False,
utc=None,
box=True,
format=None,
exact=True,
unit=None,
infer_datetime_format=False,
origin="unix",
cache=False,
):
"""Convert the arg to datetime format. If not Ray DataFrame, this falls
ba... | python | def to_datetime(
arg,
errors="raise",
dayfirst=False,
yearfirst=False,
utc=None,
box=True,
format=None,
exact=True,
unit=None,
infer_datetime_format=False,
origin="unix",
cache=False,
):
"""Convert the arg to datetime format. If not Ray DataFrame, this falls
ba... | [
"def",
"to_datetime",
"(",
"arg",
",",
"errors",
"=",
"\"raise\"",
",",
"dayfirst",
"=",
"False",
",",
"yearfirst",
"=",
"False",
",",
"utc",
"=",
"None",
",",
"box",
"=",
"True",
",",
"format",
"=",
"None",
",",
"exact",
"=",
"True",
",",
"unit",
... | Convert the arg to datetime format. If not Ray DataFrame, this falls
back on pandas.
Args:
errors ('raise' or 'ignore'): If 'ignore', errors are silenced.
Pandas blatantly ignores this argument so we will too.
dayfirst (bool): Date format is passed in as day first.
yearfi... | [
"Convert",
"the",
"arg",
"to",
"datetime",
"format",
".",
"If",
"not",
"Ray",
"DataFrame",
"this",
"falls",
"back",
"on",
"pandas",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/datetimes.py#L10-L77 |
27,478 | modin-project/modin | modin/engines/base/frame/partition_manager.py | BaseFrameManager.copartition_datasets | def copartition_datasets(self, axis, other, left_func, right_func):
"""Copartition two BlockPartitions objects.
Args:
axis: The axis to copartition.
other: The other BlockPartitions object to copartition with.
left_func: The function to apply to left. If None, just u... | python | def copartition_datasets(self, axis, other, left_func, right_func):
"""Copartition two BlockPartitions objects.
Args:
axis: The axis to copartition.
other: The other BlockPartitions object to copartition with.
left_func: The function to apply to left. If None, just u... | [
"def",
"copartition_datasets",
"(",
"self",
",",
"axis",
",",
"other",
",",
"left_func",
",",
"right_func",
")",
":",
"if",
"left_func",
"is",
"None",
":",
"new_self",
"=",
"self",
"else",
":",
"new_self",
"=",
"self",
".",
"map_across_full_axis",
"(",
"ax... | Copartition two BlockPartitions objects.
Args:
axis: The axis to copartition.
other: The other BlockPartitions object to copartition with.
left_func: The function to apply to left. If None, just use the dimension
of self (based on axis).
right_fun... | [
"Copartition",
"two",
"BlockPartitions",
"objects",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L231-L275 |
27,479 | modin-project/modin | modin/engines/base/frame/partition_manager.py | BaseFrameManager.concat | def concat(self, axis, other_blocks):
"""Concatenate the blocks with another set of blocks.
Note: Assumes that the blocks are already the same shape on the
dimension being concatenated. A ValueError will be thrown if this
condition is not met.
Args:
axis: Th... | python | def concat(self, axis, other_blocks):
"""Concatenate the blocks with another set of blocks.
Note: Assumes that the blocks are already the same shape on the
dimension being concatenated. A ValueError will be thrown if this
condition is not met.
Args:
axis: Th... | [
"def",
"concat",
"(",
"self",
",",
"axis",
",",
"other_blocks",
")",
":",
"if",
"type",
"(",
"other_blocks",
")",
"is",
"list",
":",
"other_blocks",
"=",
"[",
"blocks",
".",
"partitions",
"for",
"blocks",
"in",
"other_blocks",
"]",
"return",
"self",
".",... | Concatenate the blocks with another set of blocks.
Note: Assumes that the blocks are already the same shape on the
dimension being concatenated. A ValueError will be thrown if this
condition is not met.
Args:
axis: The axis to concatenate to.
other_block... | [
"Concatenate",
"the",
"blocks",
"with",
"another",
"set",
"of",
"blocks",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L398-L421 |
27,480 | modin-project/modin | modin/engines/base/frame/partition_manager.py | BaseFrameManager.to_pandas | def to_pandas(self, is_transposed=False):
"""Convert this object into a Pandas DataFrame from the partitions.
Args:
is_transposed: A flag for telling this object that the external
representation is transposed, but not the internal.
Returns:
A Pandas Data... | python | def to_pandas(self, is_transposed=False):
"""Convert this object into a Pandas DataFrame from the partitions.
Args:
is_transposed: A flag for telling this object that the external
representation is transposed, but not the internal.
Returns:
A Pandas Data... | [
"def",
"to_pandas",
"(",
"self",
",",
"is_transposed",
"=",
"False",
")",
":",
"# In the case this is transposed, it is easier to just temporarily",
"# transpose back then transpose after the conversion. The performance",
"# is the same as if we individually transposed the blocks and",
"# ... | Convert this object into a Pandas DataFrame from the partitions.
Args:
is_transposed: A flag for telling this object that the external
representation is transposed, but not the internal.
Returns:
A Pandas DataFrame | [
"Convert",
"this",
"object",
"into",
"a",
"Pandas",
"DataFrame",
"from",
"the",
"partitions",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L439-L481 |
27,481 | modin-project/modin | modin/engines/base/frame/partition_manager.py | BaseFrameManager.get_indices | def get_indices(self, axis=0, index_func=None, old_blocks=None):
"""This gets the internal indices stored in the partitions.
Note: These are the global indices of the object. This is mostly useful
when you have deleted rows/columns internally, but do not know
which ones were del... | python | def get_indices(self, axis=0, index_func=None, old_blocks=None):
"""This gets the internal indices stored in the partitions.
Note: These are the global indices of the object. This is mostly useful
when you have deleted rows/columns internally, but do not know
which ones were del... | [
"def",
"get_indices",
"(",
"self",
",",
"axis",
"=",
"0",
",",
"index_func",
"=",
"None",
",",
"old_blocks",
"=",
"None",
")",
":",
"ErrorMessage",
".",
"catch_bugs_and_request_email",
"(",
"not",
"callable",
"(",
"index_func",
")",
")",
"func",
"=",
"self... | This gets the internal indices stored in the partitions.
Note: These are the global indices of the object. This is mostly useful
when you have deleted rows/columns internally, but do not know
which ones were deleted.
Args:
axis: This axis to extract the labels. (0 -... | [
"This",
"gets",
"the",
"internal",
"indices",
"stored",
"in",
"the",
"partitions",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L503-L566 |
27,482 | modin-project/modin | modin/engines/base/frame/partition_manager.py | BaseFrameManager._get_blocks_containing_index | def _get_blocks_containing_index(self, axis, index):
"""Convert a global index to a block index and local index.
Note: This method is primarily used to convert a global index into a
partition index (along the axis provided) and local index (useful
for `iloc` or similar operation... | python | def _get_blocks_containing_index(self, axis, index):
"""Convert a global index to a block index and local index.
Note: This method is primarily used to convert a global index into a
partition index (along the axis provided) and local index (useful
for `iloc` or similar operation... | [
"def",
"_get_blocks_containing_index",
"(",
"self",
",",
"axis",
",",
"index",
")",
":",
"if",
"not",
"axis",
":",
"ErrorMessage",
".",
"catch_bugs_and_request_email",
"(",
"index",
">",
"sum",
"(",
"self",
".",
"block_widths",
")",
")",
"cumulative_column_width... | Convert a global index to a block index and local index.
Note: This method is primarily used to convert a global index into a
partition index (along the axis provided) and local index (useful
for `iloc` or similar operations.
Args:
axis: The axis along which to get ... | [
"Convert",
"a",
"global",
"index",
"to",
"a",
"block",
"index",
"and",
"local",
"index",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L580-L618 |
27,483 | modin-project/modin | modin/engines/base/frame/partition_manager.py | BaseFrameManager._get_dict_of_block_index | def _get_dict_of_block_index(self, axis, indices, ordered=False):
"""Convert indices to a dict of block index to internal index mapping.
Note: See `_get_blocks_containing_index` for primary usage. This method
accepts a list of indices rather than just a single value, and uses
`_... | python | def _get_dict_of_block_index(self, axis, indices, ordered=False):
"""Convert indices to a dict of block index to internal index mapping.
Note: See `_get_blocks_containing_index` for primary usage. This method
accepts a list of indices rather than just a single value, and uses
`_... | [
"def",
"_get_dict_of_block_index",
"(",
"self",
",",
"axis",
",",
"indices",
",",
"ordered",
"=",
"False",
")",
":",
"# Get the internal index and create a dictionary so we only have to",
"# travel to each partition once.",
"all_partitions_and_idx",
"=",
"[",
"self",
".",
"... | Convert indices to a dict of block index to internal index mapping.
Note: See `_get_blocks_containing_index` for primary usage. This method
accepts a list of indices rather than just a single value, and uses
`_get_blocks_containing_index`.
Args:
axis: The axis along... | [
"Convert",
"indices",
"to",
"a",
"dict",
"of",
"block",
"index",
"to",
"internal",
"index",
"mapping",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L620-L668 |
27,484 | modin-project/modin | modin/engines/base/frame/partition_manager.py | BaseFrameManager._apply_func_to_list_of_partitions | def _apply_func_to_list_of_partitions(self, func, partitions, **kwargs):
"""Applies a function to a list of remote partitions.
Note: The main use for this is to preprocess the func.
Args:
func: The func to apply
partitions: The list of partitions
Returns:
... | python | def _apply_func_to_list_of_partitions(self, func, partitions, **kwargs):
"""Applies a function to a list of remote partitions.
Note: The main use for this is to preprocess the func.
Args:
func: The func to apply
partitions: The list of partitions
Returns:
... | [
"def",
"_apply_func_to_list_of_partitions",
"(",
"self",
",",
"func",
",",
"partitions",
",",
"*",
"*",
"kwargs",
")",
":",
"preprocessed_func",
"=",
"self",
".",
"preprocess_func",
"(",
"func",
")",
"return",
"[",
"obj",
".",
"apply",
"(",
"preprocessed_func"... | Applies a function to a list of remote partitions.
Note: The main use for this is to preprocess the func.
Args:
func: The func to apply
partitions: The list of partitions
Returns:
A list of BaseFramePartition objects. | [
"Applies",
"a",
"function",
"to",
"a",
"list",
"of",
"remote",
"partitions",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L670-L683 |
27,485 | modin-project/modin | modin/engines/base/frame/partition_manager.py | BaseFrameManager.apply_func_to_select_indices | def apply_func_to_select_indices(self, axis, func, indices, keep_remaining=False):
"""Applies a function to select indices.
Note: Your internal function must take a kwarg `internal_indices` for
this to work correctly. This prevents information leakage of the
internal index to th... | python | def apply_func_to_select_indices(self, axis, func, indices, keep_remaining=False):
"""Applies a function to select indices.
Note: Your internal function must take a kwarg `internal_indices` for
this to work correctly. This prevents information leakage of the
internal index to th... | [
"def",
"apply_func_to_select_indices",
"(",
"self",
",",
"axis",
",",
"func",
",",
"indices",
",",
"keep_remaining",
"=",
"False",
")",
":",
"if",
"self",
".",
"partitions",
".",
"size",
"==",
"0",
":",
"return",
"np",
".",
"array",
"(",
"[",
"[",
"]",... | Applies a function to select indices.
Note: Your internal function must take a kwarg `internal_indices` for
this to work correctly. This prevents information leakage of the
internal index to the external representation.
Args:
axis: The axis to apply the func over.
... | [
"Applies",
"a",
"function",
"to",
"select",
"indices",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L685-L803 |
27,486 | modin-project/modin | modin/engines/base/frame/partition_manager.py | BaseFrameManager.apply_func_to_indices_both_axis | def apply_func_to_indices_both_axis(
self,
func,
row_indices,
col_indices,
lazy=False,
keep_remaining=True,
mutate=False,
item_to_distribute=None,
):
"""
Apply a function to along both axis
Important: For your func to operate d... | python | def apply_func_to_indices_both_axis(
self,
func,
row_indices,
col_indices,
lazy=False,
keep_remaining=True,
mutate=False,
item_to_distribute=None,
):
"""
Apply a function to along both axis
Important: For your func to operate d... | [
"def",
"apply_func_to_indices_both_axis",
"(",
"self",
",",
"func",
",",
"row_indices",
",",
"col_indices",
",",
"lazy",
"=",
"False",
",",
"keep_remaining",
"=",
"True",
",",
"mutate",
"=",
"False",
",",
"item_to_distribute",
"=",
"None",
",",
")",
":",
"if... | Apply a function to along both axis
Important: For your func to operate directly on the indices provided,
it must use `row_internal_indices, col_internal_indices` as keyword
arguments. | [
"Apply",
"a",
"function",
"to",
"along",
"both",
"axis"
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L907-L987 |
27,487 | modin-project/modin | modin/engines/base/frame/partition_manager.py | BaseFrameManager.inter_data_operation | def inter_data_operation(self, axis, func, other):
"""Apply a function that requires two BaseFrameManager objects.
Args:
axis: The axis to apply the function over (0 - rows, 1 - columns)
func: The function to apply
other: The other BaseFrameManager object to apply fu... | python | def inter_data_operation(self, axis, func, other):
"""Apply a function that requires two BaseFrameManager objects.
Args:
axis: The axis to apply the function over (0 - rows, 1 - columns)
func: The function to apply
other: The other BaseFrameManager object to apply fu... | [
"def",
"inter_data_operation",
"(",
"self",
",",
"axis",
",",
"func",
",",
"other",
")",
":",
"if",
"axis",
":",
"partitions",
"=",
"self",
".",
"row_partitions",
"other_partitions",
"=",
"other",
".",
"row_partitions",
"else",
":",
"partitions",
"=",
"self"... | Apply a function that requires two BaseFrameManager objects.
Args:
axis: The axis to apply the function over (0 - rows, 1 - columns)
func: The function to apply
other: The other BaseFrameManager object to apply func to.
Returns:
A new BaseFrameManager ob... | [
"Apply",
"a",
"function",
"that",
"requires",
"two",
"BaseFrameManager",
"objects",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L989-L1017 |
27,488 | modin-project/modin | modin/engines/base/frame/partition_manager.py | BaseFrameManager.manual_shuffle | def manual_shuffle(self, axis, shuffle_func, lengths):
"""Shuffle the partitions based on the `shuffle_func`.
Args:
axis: The axis to shuffle across.
shuffle_func: The function to apply before splitting the result.
lengths: The length of each partition to split the r... | python | def manual_shuffle(self, axis, shuffle_func, lengths):
"""Shuffle the partitions based on the `shuffle_func`.
Args:
axis: The axis to shuffle across.
shuffle_func: The function to apply before splitting the result.
lengths: The length of each partition to split the r... | [
"def",
"manual_shuffle",
"(",
"self",
",",
"axis",
",",
"shuffle_func",
",",
"lengths",
")",
":",
"if",
"axis",
":",
"partitions",
"=",
"self",
".",
"row_partitions",
"else",
":",
"partitions",
"=",
"self",
".",
"column_partitions",
"func",
"=",
"self",
".... | Shuffle the partitions based on the `shuffle_func`.
Args:
axis: The axis to shuffle across.
shuffle_func: The function to apply before splitting the result.
lengths: The length of each partition to split the result into.
Returns:
A new BaseFrameManager ... | [
"Shuffle",
"the",
"partitions",
"based",
"on",
"the",
"shuffle_func",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L1019-L1036 |
27,489 | modin-project/modin | modin/pandas/io.py | _make_parser_func | def _make_parser_func(sep):
"""Creates a parser function from the given sep.
Args:
sep: The separator default to use for the parser.
Returns:
A function object.
"""
def parser_func(
filepath_or_buffer,
sep=sep,
delimiter=None,
header="infer",
... | python | def _make_parser_func(sep):
"""Creates a parser function from the given sep.
Args:
sep: The separator default to use for the parser.
Returns:
A function object.
"""
def parser_func(
filepath_or_buffer,
sep=sep,
delimiter=None,
header="infer",
... | [
"def",
"_make_parser_func",
"(",
"sep",
")",
":",
"def",
"parser_func",
"(",
"filepath_or_buffer",
",",
"sep",
"=",
"sep",
",",
"delimiter",
"=",
"None",
",",
"header",
"=",
"\"infer\"",
",",
"names",
"=",
"None",
",",
"index_col",
"=",
"None",
",",
"use... | Creates a parser function from the given sep.
Args:
sep: The separator default to use for the parser.
Returns:
A function object. | [
"Creates",
"a",
"parser",
"function",
"from",
"the",
"given",
"sep",
"."
] | 5b77d242596560c646b8405340c9ce64acb183cb | https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/io.py#L35-L101 |
27,490 | EpistasisLab/tpot | tpot/builtins/one_hot_encoder.py | auto_select_categorical_features | def auto_select_categorical_features(X, threshold=10):
"""Make a feature mask of categorical features in X.
Features with less than 10 unique values are considered categorical.
Parameters
----------
X : array-like or sparse matrix, shape=(n_samples, n_features)
Dense array or sparse matrix... | python | def auto_select_categorical_features(X, threshold=10):
"""Make a feature mask of categorical features in X.
Features with less than 10 unique values are considered categorical.
Parameters
----------
X : array-like or sparse matrix, shape=(n_samples, n_features)
Dense array or sparse matrix... | [
"def",
"auto_select_categorical_features",
"(",
"X",
",",
"threshold",
"=",
"10",
")",
":",
"feature_mask",
"=",
"[",
"]",
"for",
"column",
"in",
"range",
"(",
"X",
".",
"shape",
"[",
"1",
"]",
")",
":",
"if",
"sparse",
".",
"issparse",
"(",
"X",
")"... | Make a feature mask of categorical features in X.
Features with less than 10 unique values are considered categorical.
Parameters
----------
X : array-like or sparse matrix, shape=(n_samples, n_features)
Dense array or sparse matrix.
threshold : int
Maximum number of unique values... | [
"Make",
"a",
"feature",
"mask",
"of",
"categorical",
"features",
"in",
"X",
"."
] | b626271e6b5896a73fb9d7d29bebc7aa9100772e | https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L45-L75 |
27,491 | EpistasisLab/tpot | tpot/builtins/one_hot_encoder.py | _X_selected | def _X_selected(X, selected):
"""Split X into selected features and other features"""
n_features = X.shape[1]
ind = np.arange(n_features)
sel = np.zeros(n_features, dtype=bool)
sel[np.asarray(selected)] = True
non_sel = np.logical_not(sel)
n_selected = np.sum(sel)
X_sel = X[:, ind[sel]]
... | python | def _X_selected(X, selected):
"""Split X into selected features and other features"""
n_features = X.shape[1]
ind = np.arange(n_features)
sel = np.zeros(n_features, dtype=bool)
sel[np.asarray(selected)] = True
non_sel = np.logical_not(sel)
n_selected = np.sum(sel)
X_sel = X[:, ind[sel]]
... | [
"def",
"_X_selected",
"(",
"X",
",",
"selected",
")",
":",
"n_features",
"=",
"X",
".",
"shape",
"[",
"1",
"]",
"ind",
"=",
"np",
".",
"arange",
"(",
"n_features",
")",
"sel",
"=",
"np",
".",
"zeros",
"(",
"n_features",
",",
"dtype",
"=",
"bool",
... | Split X into selected features and other features | [
"Split",
"X",
"into",
"selected",
"features",
"and",
"other",
"features"
] | b626271e6b5896a73fb9d7d29bebc7aa9100772e | https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L78-L88 |
27,492 | EpistasisLab/tpot | tpot/builtins/one_hot_encoder.py | _transform_selected | def _transform_selected(X, transform, selected, copy=True):
"""Apply a transform function to portion of selected features.
Parameters
----------
X : array-like or sparse matrix, shape=(n_samples, n_features)
Dense array or sparse matrix.
transform : callable
A callable transform(X)... | python | def _transform_selected(X, transform, selected, copy=True):
"""Apply a transform function to portion of selected features.
Parameters
----------
X : array-like or sparse matrix, shape=(n_samples, n_features)
Dense array or sparse matrix.
transform : callable
A callable transform(X)... | [
"def",
"_transform_selected",
"(",
"X",
",",
"transform",
",",
"selected",
",",
"copy",
"=",
"True",
")",
":",
"if",
"selected",
"==",
"\"all\"",
":",
"return",
"transform",
"(",
"X",
")",
"if",
"len",
"(",
"selected",
")",
"==",
"0",
":",
"return",
... | Apply a transform function to portion of selected features.
Parameters
----------
X : array-like or sparse matrix, shape=(n_samples, n_features)
Dense array or sparse matrix.
transform : callable
A callable transform(X) -> X_transformed
copy : boolean, optional
Copy X even... | [
"Apply",
"a",
"transform",
"function",
"to",
"portion",
"of",
"selected",
"features",
"."
] | b626271e6b5896a73fb9d7d29bebc7aa9100772e | https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L91-L133 |
27,493 | EpistasisLab/tpot | tpot/builtins/one_hot_encoder.py | OneHotEncoder._matrix_adjust | def _matrix_adjust(self, X):
"""Adjust all values in X to encode for NaNs and infinities in the data.
Parameters
----------
X : array-like, shape=(n_samples, n_feature)
Input array of type int.
Returns
-------
X : array-like, shape=(n_samples, n_feat... | python | def _matrix_adjust(self, X):
"""Adjust all values in X to encode for NaNs and infinities in the data.
Parameters
----------
X : array-like, shape=(n_samples, n_feature)
Input array of type int.
Returns
-------
X : array-like, shape=(n_samples, n_feat... | [
"def",
"_matrix_adjust",
"(",
"self",
",",
"X",
")",
":",
"data_matrix",
"=",
"X",
".",
"data",
"if",
"sparse",
".",
"issparse",
"(",
"X",
")",
"else",
"X",
"# Shift all values to specially encode for NAN/infinity/OTHER and 0",
"# Old value New Value",
"# --... | Adjust all values in X to encode for NaNs and infinities in the data.
Parameters
----------
X : array-like, shape=(n_samples, n_feature)
Input array of type int.
Returns
-------
X : array-like, shape=(n_samples, n_feature)
Input array without any... | [
"Adjust",
"all",
"values",
"in",
"X",
"to",
"encode",
"for",
"NaNs",
"and",
"infinities",
"in",
"the",
"data",
"."
] | b626271e6b5896a73fb9d7d29bebc7aa9100772e | https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L239-L267 |
27,494 | EpistasisLab/tpot | tpot/builtins/one_hot_encoder.py | OneHotEncoder.fit_transform | def fit_transform(self, X, y=None):
"""Fit OneHotEncoder to X, then transform X.
Equivalent to self.fit(X).transform(X), but more convenient and more
efficient. See fit for the parameters, transform for the return value.
Parameters
----------
X : array-like or sparse ma... | python | def fit_transform(self, X, y=None):
"""Fit OneHotEncoder to X, then transform X.
Equivalent to self.fit(X).transform(X), but more convenient and more
efficient. See fit for the parameters, transform for the return value.
Parameters
----------
X : array-like or sparse ma... | [
"def",
"fit_transform",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"if",
"self",
".",
"categorical_features",
"==",
"\"auto\"",
":",
"self",
".",
"categorical_features",
"=",
"auto_select_categorical_features",
"(",
"X",
",",
"threshold",
"=",
"... | Fit OneHotEncoder to X, then transform X.
Equivalent to self.fit(X).transform(X), but more convenient and more
efficient. See fit for the parameters, transform for the return value.
Parameters
----------
X : array-like or sparse matrix, shape=(n_samples, n_features)
... | [
"Fit",
"OneHotEncoder",
"to",
"X",
"then",
"transform",
"X",
"."
] | b626271e6b5896a73fb9d7d29bebc7aa9100772e | https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L376-L397 |
27,495 | EpistasisLab/tpot | tpot/builtins/one_hot_encoder.py | OneHotEncoder.transform | def transform(self, X):
"""Transform X using one-hot encoding.
Parameters
----------
X : array-like or sparse matrix, shape=(n_samples, n_features)
Dense array or sparse matrix.
Returns
-------
X_out : sparse matrix if sparse=True else a 2-d array, d... | python | def transform(self, X):
"""Transform X using one-hot encoding.
Parameters
----------
X : array-like or sparse matrix, shape=(n_samples, n_features)
Dense array or sparse matrix.
Returns
-------
X_out : sparse matrix if sparse=True else a 2-d array, d... | [
"def",
"transform",
"(",
"self",
",",
"X",
")",
":",
"return",
"_transform_selected",
"(",
"X",
",",
"self",
".",
"_transform",
",",
"self",
".",
"categorical_features",
",",
"copy",
"=",
"True",
")"
] | Transform X using one-hot encoding.
Parameters
----------
X : array-like or sparse matrix, shape=(n_samples, n_features)
Dense array or sparse matrix.
Returns
-------
X_out : sparse matrix if sparse=True else a 2-d array, dtype=int
Transformed in... | [
"Transform",
"X",
"using",
"one",
"-",
"hot",
"encoding",
"."
] | b626271e6b5896a73fb9d7d29bebc7aa9100772e | https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L481-L498 |
27,496 | EpistasisLab/tpot | tpot/base.py | TPOTBase._setup_memory | def _setup_memory(self):
"""Setup Memory object for memory caching.
"""
if self.memory:
if isinstance(self.memory, str):
if self.memory == "auto":
# Create a temporary folder to store the transformers of the pipeline
self._cache... | python | def _setup_memory(self):
"""Setup Memory object for memory caching.
"""
if self.memory:
if isinstance(self.memory, str):
if self.memory == "auto":
# Create a temporary folder to store the transformers of the pipeline
self._cache... | [
"def",
"_setup_memory",
"(",
"self",
")",
":",
"if",
"self",
".",
"memory",
":",
"if",
"isinstance",
"(",
"self",
".",
"memory",
",",
"str",
")",
":",
"if",
"self",
".",
"memory",
"==",
"\"auto\"",
":",
"# Create a temporary folder to store the transformers of... | Setup Memory object for memory caching. | [
"Setup",
"Memory",
"object",
"for",
"memory",
"caching",
"."
] | b626271e6b5896a73fb9d7d29bebc7aa9100772e | https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L783-L809 |
27,497 | EpistasisLab/tpot | tpot/base.py | TPOTBase._update_top_pipeline | def _update_top_pipeline(self):
"""Helper function to update the _optimized_pipeline field."""
# Store the pipeline with the highest internal testing score
if self._pareto_front:
self._optimized_pipeline_score = -float('inf')
for pipeline, pipeline_scores in zip(self._par... | python | def _update_top_pipeline(self):
"""Helper function to update the _optimized_pipeline field."""
# Store the pipeline with the highest internal testing score
if self._pareto_front:
self._optimized_pipeline_score = -float('inf')
for pipeline, pipeline_scores in zip(self._par... | [
"def",
"_update_top_pipeline",
"(",
"self",
")",
":",
"# Store the pipeline with the highest internal testing score",
"if",
"self",
".",
"_pareto_front",
":",
"self",
".",
"_optimized_pipeline_score",
"=",
"-",
"float",
"(",
"'inf'",
")",
"for",
"pipeline",
",",
"pipe... | Helper function to update the _optimized_pipeline field. | [
"Helper",
"function",
"to",
"update",
"the",
"_optimized_pipeline",
"field",
"."
] | b626271e6b5896a73fb9d7d29bebc7aa9100772e | https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L819-L848 |
27,498 | EpistasisLab/tpot | tpot/base.py | TPOTBase._summary_of_best_pipeline | def _summary_of_best_pipeline(self, features, target):
"""Print out best pipeline at the end of optimization process.
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
target: array-like {n_samples}
List of class labels fo... | python | def _summary_of_best_pipeline(self, features, target):
"""Print out best pipeline at the end of optimization process.
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
target: array-like {n_samples}
List of class labels fo... | [
"def",
"_summary_of_best_pipeline",
"(",
"self",
",",
"features",
",",
"target",
")",
":",
"if",
"not",
"self",
".",
"_optimized_pipeline",
":",
"raise",
"RuntimeError",
"(",
"'There was an error in the TPOT optimization '",
"'process. This could be because the data was '",
... | Print out best pipeline at the end of optimization process.
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
target: array-like {n_samples}
List of class labels for prediction
Returns
-------
self: object... | [
"Print",
"out",
"best",
"pipeline",
"at",
"the",
"end",
"of",
"optimization",
"process",
"."
] | b626271e6b5896a73fb9d7d29bebc7aa9100772e | https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L850-L895 |
27,499 | EpistasisLab/tpot | tpot/base.py | TPOTBase.predict | def predict(self, features):
"""Use the optimized pipeline to predict the target for a feature set.
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
Returns
----------
array-like: {n_samples}
Predicted tar... | python | def predict(self, features):
"""Use the optimized pipeline to predict the target for a feature set.
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
Returns
----------
array-like: {n_samples}
Predicted tar... | [
"def",
"predict",
"(",
"self",
",",
"features",
")",
":",
"if",
"not",
"self",
".",
"fitted_pipeline_",
":",
"raise",
"RuntimeError",
"(",
"'A pipeline has not yet been optimized. Please call fit() first.'",
")",
"features",
"=",
"self",
".",
"_check_dataset",
"(",
... | Use the optimized pipeline to predict the target for a feature set.
Parameters
----------
features: array-like {n_samples, n_features}
Feature matrix
Returns
----------
array-like: {n_samples}
Predicted target for the samples in the feature matri... | [
"Use",
"the",
"optimized",
"pipeline",
"to",
"predict",
"the",
"target",
"for",
"a",
"feature",
"set",
"."
] | b626271e6b5896a73fb9d7d29bebc7aa9100772e | https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L897-L916 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.