Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def reset_index(self, **kwargs):
drop = kwargs.get("drop", False)
new_index = pandas.RangeIndex(len(self.index))
if not drop:
if isinstance(self.index, pandas.MultiIndex):
# TODO (devin-petersohn) ensure partitioni... | [
"Removes all levels from index and sets a default level_0 index.\n\n Returns:\n A new QueryCompiler with updated data and reset index.\n "
] |
Please provide a description of the function:def transpose(self, *args, **kwargs):
new_data = self.data.transpose(*args, **kwargs)
# Switch the index and columns and transpose the
new_manager = self.__constructor__(new_data, self.columns, self.index)
# It is possible that this i... | [
"Transposes this DataManager.\n\n Returns:\n Transposed new DataManager.\n "
] |
Please provide a description of the function: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(map_func)
full_frame = mapped_parts.map_across_full_axis(axis, reduce_func)
... | [
"Apply function that will reduce the data to a Pandas Series.\n\n Args:\n axis: 0 for columns and 1 for rows. Default is 0.\n map_func: Callable function to map the dataframe.\n reduce_func: Callable function to reduce the dataframe. If none,\n then apply map_f... |
Please provide a description of the function:def count(self, **kwargs):
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.transpose().count(**kwargs)
axis = kwargs.get("axis", 0)
map_func = self._build_mapreduce_func(pandas.DataFrame.... | [
"Counts the number of non-NaN objects for each column or row.\n\n Return:\n A new QueryCompiler object containing counts of non-NaN objects from each\n column or row.\n "
] |
Please provide a description of the function:def mean(self, **kwargs):
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.transpose().mean(**kwargs)
# Pandas default is 0 (though not mentioned in docs)
axis = kwargs.get("axis", 0)
... | [
"Returns the mean for each numerical column or row.\n\n Return:\n A new QueryCompiler object containing the mean from each numerical column or\n row.\n "
] |
Please provide a description of the function:def min(self, **kwargs):
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.transpose().min(**kwargs)
mapreduce_func = self._build_mapreduce_func(pandas.DataFrame.min, **kwargs)
return self.... | [
"Returns the minimum from each column or row.\n\n Return:\n A new QueryCompiler object with the minimum value from each column or row.\n "
] |
Please provide a description of the function:def _process_sum_prod(self, func, **kwargs):
axis = kwargs.get("axis", 0)
min_count = kwargs.get("min_count", 0)
def sum_prod_builder(df, **kwargs):
return func(df, **kwargs)
if min_count <= 1:
return self._f... | [
"Calculates the sum or product of the DataFrame.\n\n Args:\n func: Pandas func to apply to DataFrame.\n ignore_axis: Whether to ignore axis when raising TypeError\n Return:\n A new QueryCompiler object with sum or prod of the object.\n "
] |
Please provide a description of the function:def prod(self, **kwargs):
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.transpose().prod(**kwargs)
return self._process_sum_prod(
self._build_mapreduce_func(pandas.DataFrame.prod, *... | [
"Returns the product of each numerical column or row.\n\n Return:\n A new QueryCompiler object with the product of each numerical column or row.\n "
] |
Please provide a description of the function:def _process_all_any(self, func, **kwargs):
axis = kwargs.get("axis", 0)
axis = 0 if axis is None else axis
kwargs["axis"] = axis
builder_func = self._build_mapreduce_func(func, **kwargs)
return self._full_reduce(axis, builder... | [
"Calculates if any or all the values are true.\n\n Return:\n A new QueryCompiler object containing boolean values or boolean.\n "
] |
Please provide a description of the function:def all(self, **kwargs):
if self._is_transposed:
# Pandas ignores on axis=1
kwargs["bool_only"] = False
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.transpose().all(**kwargs)
return self._proc... | [
"Returns whether all the elements are true, potentially over an axis.\n\n Return:\n A new QueryCompiler object containing boolean values or boolean.\n "
] |
Please provide a description of the function: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(self.columns.get_indexer_for(columns))
# Create Series fo... | [
"Converts columns dtypes to given dtypes.\n\n Args:\n col_dtypes: Dictionary of {col: dtype,...} where col is the column\n name and dtype is a numpy dtype.\n\n Returns:\n DataFrame with updated dtypes.\n "
] |
Please provide a description of the function:def _full_axis_reduce(self, axis, func, alternate_index=None):
result = self.data.map_across_full_axis(axis, func)
if axis == 0:
columns = alternate_index if alternate_index is not None else self.columns
return self.__construc... | [
"Applies map that reduce Manager to series but require knowledge of full axis.\n\n Args:\n func: Function to reduce the Manager by. This function takes in a Manager.\n axis: axis to apply the function to.\n alternate_index: If the resulting series should have an index\n ... |
Please provide a description of the function:def first_valid_index(self):
# It may be possible to incrementally check each partition, but this
# computation is fairly cheap.
def first_valid_index_builder(df):
df.index = pandas.RangeIndex(len(df.index))
return df.... | [
"Returns index of first non-NaN/NULL value.\n\n Return:\n Scalar of index name.\n "
] |
Please provide a description of the function:def idxmax(self, **kwargs):
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.transpose().idxmax(**kwargs)
axis = kwargs.get("axis", 0)
index = self.index if axis == 0 else self.columns
... | [
"Returns the first occurrence of the maximum over requested axis.\n\n Returns:\n A new QueryCompiler object containing the maximum of each column or axis.\n "
] |
Please provide a description of the function:def idxmin(self, **kwargs):
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.transpose().idxmin(**kwargs)
axis = kwargs.get("axis", 0)
index = self.index if axis == 0 else self.columns
... | [
"Returns the first occurrence of the minimum over requested axis.\n\n Returns:\n A new QueryCompiler object containing the minimum of each column or axis.\n "
] |
Please provide a description of the function:def last_valid_index(self):
def last_valid_index_builder(df):
df.index = pandas.RangeIndex(len(df.index))
return df.apply(lambda df: df.last_valid_index())
func = self._build_mapreduce_func(last_valid_index_builder)
... | [
"Returns index of last non-NaN/NULL value.\n\n Return:\n Scalar of index name.\n "
] |
Please provide a description of the function:def median(self, **kwargs):
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.transpose().median(**kwargs)
# Pandas default is 0 (though not mentioned in docs)
axis = kwargs.get("axis", 0)
... | [
"Returns median of each column or row.\n\n Returns:\n A new QueryCompiler object containing the median of each column or row.\n "
] |
Please provide a description of the function:def memory_usage(self, **kwargs):
def memory_usage_builder(df, **kwargs):
return df.memory_usage(**kwargs)
func = self._build_mapreduce_func(memory_usage_builder, **kwargs)
return self._full_axis_reduce(0, func) | [
"Returns the memory usage of each column.\n\n Returns:\n A new QueryCompiler object containing the memory usage of each column.\n "
] |
Please provide a description of the function:def quantile_for_single_value(self, **kwargs):
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.transpose().quantile_for_single_value(**kwargs)
axis = kwargs.get("axis", 0)
q = kwargs.get(... | [
"Returns quantile of each column or row.\n\n Returns:\n A new QueryCompiler object containing the quantile of each column or row.\n "
] |
Please provide a description of the function: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 = [i for i, name in enumerate(old_index) if name in index]
resu... | [
"Reduce Manger along select indices using function that needs full axis.\n\n Args:\n func: Callable that reduces the dimension of the object and requires full\n knowledge of the entire axis.\n axis: 0 for columns and 1 for rows. Defaults to 0.\n index: Index of... |
Please provide a description of the function:def describe(self, **kwargs):
# Use pandas to calculate the correct columns
new_columns = (
pandas.DataFrame(columns=self.columns)
.astype(self.dtypes)
.describe(**kwargs)
.columns
)
de... | [
"Generates descriptive statistics.\n\n Returns:\n DataFrame object containing the descriptive statistics of the DataFrame.\n "
] |
Please provide a description of the function:def dropna(self, **kwargs):
axis = kwargs.get("axis", 0)
subset = kwargs.get("subset", None)
thresh = kwargs.get("thresh", None)
how = kwargs.get("how", "any")
# We need to subset the axis that we care about with `subset`. Thi... | [
"Returns a new QueryCompiler with null values dropped along given axis.\n Return:\n a new DataManager\n "
] |
Please provide a description of the function:def eval(self, expr, **kwargs):
columns = self.index if self._is_transposed else self.columns
index = self.columns if self._is_transposed else self.index
# Make a copy of columns and eval on the copy to determine if result type is
# ... | [
"Returns a new QueryCompiler with expr evaluated on columns.\n\n Args:\n expr: The string expression to evaluate.\n\n Returns:\n A new QueryCompiler with new columns after applying expr.\n "
] |
Please provide a description of the function:def mode(self, **kwargs):
axis = kwargs.get("axis", 0)
def mode_builder(df, **kwargs):
result = df.mode(**kwargs)
# We return a dataframe with the same shape as the input to ensure
# that all the partitions will b... | [
"Returns a new QueryCompiler with modes calculated for each label along given axis.\n\n Returns:\n A new QueryCompiler with modes calculated.\n "
] |
Please provide a description of the function:def fillna(self, **kwargs):
axis = kwargs.get("axis", 0)
value = kwargs.get("value")
if isinstance(value, dict):
value = kwargs.pop("value")
if axis == 0:
index = self.columns
else:
... | [
"Replaces NaN values with the method provided.\n\n Returns:\n A new QueryCompiler with null values filled.\n "
] |
Please provide a description of the function:def query(self, expr, **kwargs):
columns = self.columns
def query_builder(df, **kwargs):
# This is required because of an Arrow limitation
# TODO revisit for Arrow error
df = df.copy()
df.index = panda... | [
"Query columns of the DataManager with a boolean expression.\n\n Args:\n expr: Boolean expression to query the columns with.\n\n Returns:\n DataManager containing the rows where the boolean expression is satisfied.\n "
] |
Please provide a description of the function:def rank(self, **kwargs):
axis = kwargs.get("axis", 0)
numeric_only = True if axis else kwargs.get("numeric_only", False)
func = self._prepare_method(pandas.DataFrame.rank, **kwargs)
new_data = self._map_across_full_axis(axis, func)
... | [
"Computes numerical rank along axis. Equal values are set to the average.\n\n Returns:\n DataManager containing the ranks of the values along an axis.\n "
] |
Please provide a description of the function:def sort_index(self, **kwargs):
axis = kwargs.pop("axis", 0)
index = self.columns if axis else self.index
# sort_index can have ascending be None and behaves as if it is False.
# sort_values cannot have ascending be None. Thus, the f... | [
"Sorts the data with respect to either the columns or the indices.\n\n Returns:\n DataManager containing the data sorted by columns or indices.\n "
] |
Please provide a description of the function: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, indices, keep_remaining
) | [
"Maps function to select indices along full axis.\n\n Args:\n axis: 0 for columns and 1 for rows.\n func: Callable mapping function over the BlockParitions.\n indices: indices along axis to map over.\n keep_remaining: True if keep indices where function was not app... |
Please provide a description of the function:def quantile_for_list_of_values(self, **kwargs):
if self._is_transposed:
kwargs["axis"] = kwargs.get("axis", 0) ^ 1
return self.transpose().quantile_for_list_of_values(**kwargs)
axis = kwargs.get("axis", 0)
q = kwargs.... | [
"Returns Manager containing quantiles along an axis for numeric columns.\n\n Returns:\n DataManager containing quantiles of original DataManager along an axis.\n "
] |
Please provide a description of the function: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_transposed:
result = self.__constructor__(
self.data.transpose().take(1,... | [
"Returns the last n rows.\n\n Args:\n n: Integer containing the number of rows to return.\n\n Returns:\n DataManager containing the last n rows of the original DataManager.\n "
] |
Please provide a description of the function: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 transposed behavior
if self._is_transposed:
result = self.__co... | [
"Returns the first n columns.\n\n Args:\n n: Integer containing the number of columns to return.\n\n Returns:\n DataManager containing the first n columns of the original DataManager.\n "
] |
Please provide a description of the function: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
# `apply_func_to_select_indices` will do the convers... | [
"Get column data for target labels.\n\n Args:\n key: Target labels by which to retrieve data.\n\n Returns:\n A new QueryCompiler.\n "
] |
Please provide a description of the function:def getitem_row_array(self, key):
# Convert to list for type checking
key = list(key)
def getitem(df, internal_indices=[]):
return df.iloc[internal_indices]
result = self.data.apply_func_to_select_indices(
1,... | [
"Get row data for target labels.\n\n Args:\n key: Target numeric indices by which to retrieve data.\n\n Returns:\n A new QueryCompiler.\n "
] |
Please provide a description of the function:def setitem(self, axis, key, value):
def setitem(df, internal_indices=[]):
def _setitem():
if len(internal_indices) == 1:
if axis == 0:
df[df.columns[internal_indices[0]]] = value
... | [
"Set the column defined by `key` to the `value` provided.\n\n Args:\n key: The column name to set.\n value: The value to set the column to.\n\n Returns:\n A new QueryCompiler\n "
] |
Please provide a description of the function:def drop(self, index=None, columns=None):
if self._is_transposed:
return self.transpose().drop(index=columns, columns=index).transpose()
if index is None:
new_data = self.data
new_index = self.index
else:
... | [
"Remove row data for target index and columns.\n\n Args:\n index: Target index to drop.\n columns: Target columns to drop.\n\n Returns:\n A new QueryCompiler.\n "
] |
Please provide a description of the function: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
# the data is partiti... | [
"Insert new column data.\n\n Args:\n loc: Insertion index.\n column: Column labels to insert.\n value: Dtype object values to insert.\n\n Returns:\n A new PandasQueryCompiler with new data inserted.\n "
] |
Please provide a description of the function:def apply(self, func, axis, *args, **kwargs):
if callable(func):
return self._callable_func(func, axis, *args, **kwargs)
elif isinstance(func, dict):
return self._dict_func(func, axis, *args, **kwargs)
elif is_list_lik... | [
"Apply func across given axis.\n\n Args:\n func: The function to apply.\n axis: Target axis to apply the function along.\n\n Returns:\n A new PandasQueryCompiler.\n "
] |
Please provide a description of the function:def _post_process_apply(self, result_data, axis, try_scale=True):
if try_scale:
try:
internal_index = self.compute_index(0, result_data, True)
except IndexError:
internal_index = self.compute_index(0, r... | [
"Recompute the index after applying function.\n\n Args:\n result_data: a BaseFrameManager object.\n axis: Target axis along which function was applied.\n\n Returns:\n A new PandasQueryCompiler.\n "
] |
Please provide a description of the function:def _dict_func(self, func, axis, *args, **kwargs):
if "axis" not in kwargs:
kwargs["axis"] = axis
if axis == 0:
index = self.columns
else:
index = self.index
func = {idx: func[key] for key in func ... | [
"Apply function to certain indices across given axis.\n\n Args:\n func: The function to apply.\n axis: Target axis to apply the function along.\n\n Returns:\n A new PandasQueryCompiler.\n "
] |
Please provide a description of the function:def _list_like_func(self, func, axis, *args, **kwargs):
func_prepared = self._prepare_method(
lambda df: pandas.DataFrame(df.apply(func, axis, *args, **kwargs))
)
new_data = self._map_across_full_axis(axis, func_prepared)
... | [
"Apply list-like function across given axis.\n\n Args:\n func: The function to apply.\n axis: Target axis to apply the function along.\n\n Returns:\n A new PandasQueryCompiler.\n "
] |
Please provide a description of the function:def _callable_func(self, func, axis, *args, **kwargs):
def callable_apply_builder(df, axis=0):
if not axis:
df.index = index
df.columns = pandas.RangeIndex(len(df.columns))
else:
df.col... | [
"Apply callable functions across given axis.\n\n Args:\n func: The functions to apply.\n axis: Target axis to apply the function along.\n\n Returns:\n A new PandasQueryCompiler.\n "
] |
Please provide a description of the function:def _manual_repartition(self, axis, repartition_func, **kwargs):
func = self._prepare_method(repartition_func, **kwargs)
return self.data.manual_shuffle(axis, func) | [
"This method applies all manual partitioning functions.\n\n Args:\n axis: The axis to shuffle data along.\n repartition_func: The function used to repartition data.\n\n Returns:\n A `BaseFrameManager` object.\n "
] |
Please provide a description of the function: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:
columns = [c for c in self.columns if not is_num... | [
"Convert categorical variables to dummy variables for certain columns.\n\n Args:\n columns: The columns to convert.\n\n Returns:\n A new QueryCompiler.\n "
] |
Please provide a description of the function:def global_idx_to_numeric_idx(self, axis, indices):
assert axis in ["row", "col", "columns"]
if axis == "row":
return pandas.Index(
pandas.Series(np.arange(len(self.index)), index=self.index)
.loc[indices]
... | [
"\n Note: this function involves making copies of the index in memory.\n\n Args:\n axis: Axis to extract indices.\n indices: Indices to convert to numerical.\n\n Returns:\n An Index object.\n "
] |
Please provide a description of the function:def _get_data(self) -> BaseFrameManager:
def iloc(partition, row_internal_indices, col_internal_indices):
return partition.iloc[row_internal_indices, col_internal_indices]
masked_data = self.parent_data.apply_func_to_indices_both_axis(
... | [
"Perform the map step\n\n Returns:\n A BaseFrameManager object.\n "
] |
Please provide a description of the function:def block_lengths(self):
if self._lengths_cache is None:
# The first column will have the correct lengths. We have an
# invariant that requires that all blocks be the same length in a
# row of blocks.
self._len... | [
"Gets the lengths of the blocks.\n\n Note: This works with the property structure `_lengths_cache` to avoid\n having to recompute these values each time they are needed.\n "
] |
Please provide a description of the function:def block_widths(self):
if self._widths_cache is None:
# The first column will have the correct lengths. We have an
# invariant that requires that all blocks be the same width in a
# column of blocks.
self._wid... | [
"Gets the widths of the blocks.\n\n Note: This works with the property structure `_widths_cache` to avoid\n having to recompute these values each time they are needed.\n "
] |
Please provide a description of the function:def _update_inplace(self, new_query_compiler):
old_query_compiler = self._query_compiler
self._query_compiler = new_query_compiler
old_query_compiler.free() | [
"Updates the current DataFrame inplace.\r\n\r\n Args:\r\n new_query_compiler: The new QueryCompiler to use to manage the data\r\n "
] |
Please provide a description of the function:def _validate_other(
self,
other,
axis,
numeric_only=False,
numeric_or_time_only=False,
numeric_or_object_only=False,
comparison_dtypes_only=False,
):
axis = self._get_axis_number(axis) if... | [
"Helper method to check validity of other in inter-df operations"
] |
Please provide a description of the function:def _default_to_pandas(self, op, *args, **kwargs):
empty_self_str = "" if not self.empty else " for empty DataFrame"
ErrorMessage.default_to_pandas(
"`{}.{}`{}".format(
self.__name__,
op if isinstance... | [
"Helper method to use default pandas function"
] |
Please provide a description of the function:def abs(self):
self._validate_dtypes(numeric_only=True)
return self.__constructor__(query_compiler=self._query_compiler.abs()) | [
"Apply an absolute value function to all numeric columns.\r\n\r\n Returns:\r\n A new DataFrame with the applied absolute value.\r\n "
] |
Please provide a description of the function:def add(self, other, axis="columns", level=None, fill_value=None):
return self._binary_op(
"add", other, axis=axis, level=level, fill_value=fill_value
) | [
"Add this DataFrame to another or a scalar/list.\r\n\r\n Args:\r\n other: What to add this this DataFrame.\r\n axis: The axis to apply addition over. Only applicaable to Series\r\n or list 'other'.\r\n level: A level in the multilevel axis to add over.\r\n ... |
Please provide a description of the function:def all(self, axis=0, bool_only=None, skipna=True, level=None, **kwargs):
if axis is not None:
axis = self._get_axis_number(axis)
if bool_only and axis == 0:
if hasattr(self, "dtype"):
raise N... | [
"Return whether all elements are True over requested axis\r\n\r\n Note:\r\n If axis=None or axis=0, this call applies df.all(axis=1)\r\n to the transpose of df.\r\n "
] |
Please provide a description of the function:def apply(
self,
func,
axis=0,
broadcast=None,
raw=False,
reduce=None,
result_type=None,
convert_dtype=True,
args=(),
**kwds
):
axis = self._get_axis_number(axis... | [
"Apply a function along input axis of DataFrame.\r\n\r\n Args:\r\n func: The function to apply\r\n axis: The axis over which to apply the func.\r\n broadcast: Whether or not to broadcast.\r\n raw: Whether or not to convert to a Series.\r\n reduce: Whethe... |
Please provide a description of the function:def bfill(self, axis=None, inplace=False, limit=None, downcast=None):
return self.fillna(
method="bfill", axis=axis, limit=limit, downcast=downcast, inplace=inplace
) | [
"Synonym for DataFrame.fillna(method='bfill')"
] |
Please provide a description of the function:def bool(self):
shape = self.shape
if shape != (1,) and shape != (1, 1):
raise ValueError(
)
else:
return self._to_pandas().bool() | [
"Return the bool of a single element PandasObject.\r\n\r\n This must be a boolean scalar value, either True or False. Raise a\r\n ValueError if the PandasObject does not have exactly 1 element, or that\r\n element is not boolean\r\n ",
"The PandasObject does not have exactly\r\n ... |
Please provide a description of the function:def copy(self, deep=True):
return self.__constructor__(query_compiler=self._query_compiler.copy()) | [
"Creates a shallow copy of the DataFrame.\r\n\r\n Returns:\r\n A new DataFrame pointing to the same partitions as this one.\r\n "
] |
Please provide a description of the function:def count(self, axis=0, level=None, numeric_only=False):
axis = self._get_axis_number(axis) if axis is not None else 0
return self._reduce_dimension(
self._query_compiler.count(
axis=axis, level=level, numeric_only=nu... | [
"Get the count of non-null objects in the DataFrame.\r\n\r\n Arguments:\r\n axis: 0 or 'index' for row-wise, 1 or 'columns' for column-wise.\r\n level: If the axis is a MultiIndex (hierarchical), count along a\r\n particular level, collapsing into a DataFrame.\r\n ... |
Please provide a description of the function:def cummax(self, axis=None, skipna=True, *args, **kwargs):
axis = self._get_axis_number(axis) if axis is not None else 0
if axis:
self._validate_dtypes()
return self.__constructor__(
query_compiler=self._query_co... | [
"Perform a cumulative maximum across the DataFrame.\r\n\r\n Args:\r\n axis (int): The axis to take maximum on.\r\n skipna (bool): True to skip NA values, false otherwise.\r\n\r\n Returns:\r\n The cumulative maximum of the DataFrame.\r\n "
] |
Please provide a description of the function:def cumprod(self, axis=None, skipna=True, *args, **kwargs):
axis = self._get_axis_number(axis) if axis is not None else 0
self._validate_dtypes(numeric_only=True)
return self.__constructor__(
query_compiler=self._query_compil... | [
"Perform a cumulative product across the DataFrame.\r\n\r\n Args:\r\n axis (int): The axis to take product on.\r\n skipna (bool): True to skip NA values, false otherwise.\r\n\r\n Returns:\r\n The cumulative product of the DataFrame.\r\n "
] |
Please provide a description of the function:def describe(self, percentiles=None, include=None, exclude=None):
if include is not None and (isinstance(include, np.dtype) or include != "all"):
if not is_list_like(include):
include = [include]
include = [
... | [
"\r\n Generates descriptive statistics that summarize the central tendency,\r\n dispersion and shape of a dataset's distribution, excluding NaN values.\r\n\r\n Args:\r\n percentiles (list-like of numbers, optional):\r\n The percentiles to include in the output.\r\n ... |
Please provide a description of the function:def diff(self, periods=1, axis=0):
axis = self._get_axis_number(axis)
return self.__constructor__(
query_compiler=self._query_compiler.diff(periods=periods, axis=axis)
) | [
"Finds the difference between elements on the axis requested\r\n\r\n Args:\r\n periods: Periods to shift for forming difference\r\n axis: Take difference over rows or columns\r\n\r\n Returns:\r\n DataFrame with the diff applied\r\n "
] |
Please provide a description of the function:def drop(
self,
labels=None,
axis=0,
index=None,
columns=None,
level=None,
inplace=False,
errors="raise",
):
# TODO implement level
if level is not None:
ret... | [
"Return new object with labels in requested axis removed.\r\n Args:\r\n labels: Index or column labels to drop.\r\n axis: Whether to drop labels from the index (0 / 'index') or\r\n columns (1 / 'columns').\r\n index, columns: Alternative to specifying axis (lab... |
Please provide a description of the function:def dropna(self, axis=0, how="any", thresh=None, subset=None, inplace=False):
inplace = validate_bool_kwarg(inplace, "inplace")
if is_list_like(axis):
axis = [self._get_axis_number(ax) for ax in axis]
result = self
... | [
"Create a new DataFrame from the removed NA values from this one.\r\n\r\n Args:\r\n axis (int, tuple, or list): The axis to apply the drop.\r\n how (str): How to drop the NA values.\r\n 'all': drop the label if all values are NA.\r\n 'any': drop the label i... |
Please provide a description of the function:def drop_duplicates(self, keep="first", inplace=False, **kwargs):
inplace = validate_bool_kwarg(inplace, "inplace")
if kwargs.get("subset", None) is not None:
duplicates = self.duplicated(keep=keep, **kwargs)
else:
... | [
"Return DataFrame with duplicate rows removed, optionally only considering certain columns\r\n\r\n Args:\r\n subset : column label or sequence of labels, optional\r\n Only consider certain columns for identifying duplicates, by\r\n default use all of t... |
Please provide a description of the function:def eq(self, other, axis="columns", level=None):
return self._binary_op("eq", other, axis=axis, level=level) | [
"Checks element-wise that this is equal to other.\r\n\r\n Args:\r\n other: A DataFrame or Series or scalar to compare to.\r\n axis: The axis to perform the eq over.\r\n level: The Multilevel index level to apply eq over.\r\n\r\n Returns:\r\n A new DataFrame ... |
Please provide a description of the function:def fillna(
self,
value=None,
method=None,
axis=None,
inplace=False,
limit=None,
downcast=None,
**kwargs
):
# TODO implement value passed as DataFrame/Series
if isinstanc... | [
"Fill NA/NaN values using the specified method.\r\n\r\n Args:\r\n value: Value to use to fill holes. This value cannot be a list.\r\n\r\n method: Method to use for filling holes in reindexed Series pad.\r\n ffill: propagate last valid observation forward to next valid\r\n... |
Please provide a description of the function:def filter(self, items=None, like=None, regex=None, axis=None):
nkw = count_not_none(items, like, regex)
if nkw > 1:
raise TypeError(
"Keyword arguments `items`, `like`, or `regex` are mutually exclusive"
... | [
"Subset rows or columns based on their labels\r\n\r\n Args:\r\n items (list): list of labels to subset\r\n like (string): retain labels where `arg in label == True`\r\n regex (string): retain labels matching regex input\r\n axis: axis to filter on\r\n\r\n Re... |
Please provide a description of the function:def floordiv(self, other, axis="columns", level=None, fill_value=None):
return self._binary_op(
"floordiv", other, axis=axis, level=level, fill_value=fill_value
) | [
"Divides this DataFrame against another DataFrame/Series/scalar.\r\n\r\n Args:\r\n other: The object to use to apply the divide against this.\r\n axis: The axis to divide over.\r\n level: The Multilevel index level to apply divide over.\r\n fill_value: The value to... |
Please provide a description of the function:def ge(self, other, axis="columns", level=None):
return self._binary_op("ge", other, axis=axis, level=level) | [
"Checks element-wise that this is greater than or equal to other.\r\n\r\n Args:\r\n other: A DataFrame or Series or scalar to compare to.\r\n axis: The axis to perform the gt over.\r\n level: The Multilevel index level to apply gt over.\r\n\r\n Returns:\r\n ... |
Please provide a description of the function:def get_dtype_counts(self):
if hasattr(self, "dtype"):
return pandas.Series({str(self.dtype): 1})
result = self.dtypes.value_counts()
result.index = result.index.map(lambda x: str(x))
return result | [
"Get the counts of dtypes in this object.\r\n\r\n Returns:\r\n The counts of dtypes in this object.\r\n "
] |
Please provide a description of the function:def get_ftype_counts(self):
if hasattr(self, "ftype"):
return pandas.Series({self.ftype: 1})
return self.ftypes.value_counts().sort_index() | [
"Get the counts of ftypes in this object.\r\n\r\n Returns:\r\n The counts of ftypes in this object.\r\n "
] |
Please provide a description of the function:def gt(self, other, axis="columns", level=None):
return self._binary_op("gt", other, axis=axis, level=level) | [
"Checks element-wise that this is greater than other.\r\n\r\n Args:\r\n other: A DataFrame or Series or scalar to compare to.\r\n axis: The axis to perform the gt over.\r\n level: The Multilevel index level to apply gt over.\r\n\r\n Returns:\r\n A new DataFr... |
Please provide a description of the function:def head(self, n=5):
if n >= len(self.index):
return self.copy()
return self.__constructor__(query_compiler=self._query_compiler.head(n)) | [
"Get the first n rows of the DataFrame.\r\n\r\n Args:\r\n n (int): The number of rows to return.\r\n\r\n Returns:\r\n A new DataFrame with the first n rows of the DataFrame.\r\n "
] |
Please provide a description of the function:def idxmax(self, axis=0, skipna=True, *args, **kwargs):
if not all(d != np.dtype("O") for d in self._get_dtypes()):
raise TypeError("reduction operation 'argmax' not allowed for this dtype")
axis = self._get_axis_number(axis)
... | [
"Get the index of the first occurrence of the max value of the axis.\r\n\r\n Args:\r\n axis (int): Identify the max over the rows (1) or columns (0).\r\n skipna (bool): Whether or not to skip NA values.\r\n\r\n Returns:\r\n A Series with the index for each maximum valu... |
Please provide a description of the function:def isin(self, values):
return self.__constructor__(
query_compiler=self._query_compiler.isin(values=values)
) | [
"Fill a DataFrame with booleans for cells contained in values.\r\n\r\n Args:\r\n values (iterable, DataFrame, Series, or dict): The values to find.\r\n\r\n Returns:\r\n A new DataFrame with booleans representing whether or not a cell\r\n is in values.\r\n Tr... |
Please provide a description of the function:def le(self, other, axis="columns", level=None):
return self._binary_op("le", other, axis=axis, level=level) | [
"Checks element-wise that this is less than or equal to other.\r\n\r\n Args:\r\n other: A DataFrame or Series or scalar to compare to.\r\n axis: The axis to perform the le over.\r\n level: The Multilevel index level to apply le over.\r\n\r\n Returns:\r\n A n... |
Please provide a description of the function:def lt(self, other, axis="columns", level=None):
return self._binary_op("lt", other, axis=axis, level=level) | [
"Checks element-wise that this is less than other.\r\n\r\n Args:\r\n other: A DataFrame or Series or scalar to compare to.\r\n axis: The axis to perform the lt over.\r\n level: The Multilevel index level to apply lt over.\r\n\r\n Returns:\r\n A new DataFrame... |
Please provide a description of the function:def mean(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
axis = self._get_axis_number(axis) if axis is not None else 0
data = self._validate_dtypes_sum_prod_mean(
axis, numeric_only, ignore_axis=False
... | [
"Computes mean across the DataFrame.\r\n\r\n Args:\r\n axis (int): The axis to take the mean on.\r\n skipna (bool): True to skip NA values, false otherwise.\r\n\r\n Returns:\r\n The mean of the DataFrame. (Pandas series)\r\n "
] |
Please provide a description of the function:def median(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
axis = self._get_axis_number(axis) if axis is not None else 0
if numeric_only is not None and not numeric_only:
self._validate_dtypes(numeric_only=True... | [
"Computes median across the DataFrame.\r\n\r\n Args:\r\n axis (int): The axis to take the median on.\r\n skipna (bool): True to skip NA values, false otherwise.\r\n\r\n Returns:\r\n The median of the DataFrame. (Pandas series)\r\n "
] |
Please provide a description of the function:def memory_usage(self, index=True, deep=False):
assert not index, "Internal Error. Index must be evaluated in child class"
return self._reduce_dimension(
self._query_compiler.memory_usage(index=index, deep=deep)
) | [
"Returns the memory usage of each column in bytes\r\n\r\n Args:\r\n index (bool): Whether to include the memory usage of the DataFrame's\r\n index in returned Series. Defaults to True\r\n deep (bool): If True, introspect the data deeply by interrogating\r\n obj... |
Please provide a description of the function:def min(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
axis = self._get_axis_number(axis) if axis is not None else 0
data = self._validate_dtypes_min_max(axis, numeric_only)
return data._reduce_dimension(
... | [
"Perform min across the DataFrame.\r\n\r\n Args:\r\n axis (int): The axis to take the min on.\r\n skipna (bool): True to skip NA values, false otherwise.\r\n\r\n Returns:\r\n The min of the DataFrame.\r\n "
] |
Please provide a description of the function:def mod(self, other, axis="columns", level=None, fill_value=None):
return self._binary_op(
"mod", other, axis=axis, level=level, fill_value=fill_value
) | [
"Mods this DataFrame against another DataFrame/Series/scalar.\r\n\r\n Args:\r\n other: The object to use to apply the mod against this.\r\n axis: The axis to mod over.\r\n level: The Multilevel index level to apply mod over.\r\n fill_value: The value to fill NaNs w... |
Please provide a description of the function:def mode(self, axis=0, numeric_only=False, dropna=True):
axis = self._get_axis_number(axis)
return self.__constructor__(
query_compiler=self._query_compiler.mode(
axis=axis, numeric_only=numeric_only, dropna=dropna
... | [
"Perform mode across the DataFrame.\r\n\r\n Args:\r\n axis (int): The axis to take the mode on.\r\n numeric_only (bool): if True, only apply to numeric columns.\r\n\r\n Returns:\r\n DataFrame: The mode of the DataFrame.\r\n "
] |
Please provide a description of the function:def mul(self, other, axis="columns", level=None, fill_value=None):
return self._binary_op(
"mul", other, axis=axis, level=level, fill_value=fill_value
) | [
"Multiplies this DataFrame against another DataFrame/Series/scalar.\r\n\r\n Args:\r\n other: The object to use to apply the multiply against this.\r\n axis: The axis to multiply over.\r\n level: The Multilevel index level to apply multiply over.\r\n fill_value: The... |
Please provide a description of the function:def ne(self, other, axis="columns", level=None):
return self._binary_op("ne", other, axis=axis, level=level) | [
"Checks element-wise that this is not equal to other.\r\n\r\n Args:\r\n other: A DataFrame or Series or scalar to compare to.\r\n axis: The axis to perform the ne over.\r\n level: The Multilevel index level to apply ne over.\r\n\r\n Returns:\r\n A new DataFr... |
Please provide a description of the function:def nunique(self, axis=0, dropna=True):
axis = self._get_axis_number(axis) if axis is not None else 0
return self._reduce_dimension(
self._query_compiler.nunique(axis=axis, dropna=dropna)
) | [
"Return Series with number of distinct\r\n observations over requested axis.\r\n\r\n Args:\r\n axis : {0 or 'index', 1 or 'columns'}, default 0\r\n dropna : boolean, default True\r\n\r\n Returns:\r\n nunique : Series\r\n "
] |
Please provide a description of the function:def pow(self, other, axis="columns", level=None, fill_value=None):
return self._binary_op(
"pow", other, axis=axis, level=level, fill_value=fill_value
) | [
"Pow this DataFrame against another DataFrame/Series/scalar.\r\n\r\n Args:\r\n other: The object to use to apply the pow against this.\r\n axis: The axis to pow over.\r\n level: The Multilevel index level to apply pow over.\r\n fill_value: The value to fill NaNs wi... |
Please provide a description of the function:def prod(
self,
axis=None,
skipna=None,
level=None,
numeric_only=None,
min_count=0,
**kwargs
):
axis = self._get_axis_number(axis) if axis is not None else 0
data = self._validate... | [
"Return the product of the values for the requested axis\r\n\r\n Args:\r\n axis : {index (0), columns (1)}\r\n skipna : boolean, default True\r\n level : int or level name, default None\r\n numeric_only : boolean, default None\r\n min_count : int, defaul... |
Please provide a description of the function:def quantile(self, q=0.5, axis=0, numeric_only=True, interpolation="linear"):
axis = self._get_axis_number(axis) if axis is not None else 0
def check_dtype(t):
return is_numeric_dtype(t) or is_datetime_or_timedelta_dtype(t)
... | [
"Return values at the given quantile over requested axis,\r\n a la numpy.percentile.\r\n\r\n Args:\r\n q (float): 0 <= q <= 1, the quantile(s) to compute\r\n axis (int): 0 or 'index' for row-wise,\r\n 1 or 'columns' for column-wise\r\n interp... |
Please provide a description of the function:def rank(
self,
axis=0,
method="average",
numeric_only=None,
na_option="keep",
ascending=True,
pct=False,
):
axis = self._get_axis_number(axis)
return self.__constructor__(
... | [
"\r\n Compute numerical data ranks (1 through n) along axis.\r\n Equal values are assigned a rank that is the [method] of\r\n the ranks of those values.\r\n\r\n Args:\r\n axis (int): 0 or 'index' for row-wise,\r\n 1 or 'columns' for column-wise\r\n ... |
Please provide a description of the function:def reset_index(
self, level=None, drop=False, inplace=False, col_level=0, col_fill=""
):
inplace = validate_bool_kwarg(inplace, "inplace")
# TODO Implement level
if level is not None:
new_query_compiler = self.... | [
"Reset this index to default and create column from current index.\r\n\r\n Args:\r\n level: Only remove the given levels from the index. Removes all\r\n levels by default\r\n drop: Do not try to insert index into DataFrame columns. This\r\n resets the index... |
Please provide a description of the function:def rmod(self, other, axis="columns", level=None, fill_value=None):
return self._binary_op(
"rmod", other, axis=axis, level=level, fill_value=fill_value
) | [
"Mod this DataFrame against another DataFrame/Series/scalar.\r\n\r\n Args:\r\n other: The object to use to apply the div against this.\r\n axis: The axis to div over.\r\n level: The Multilevel index level to apply div over.\r\n fill_value: The value to fill NaNs wi... |
Please provide a description of the function:def round(self, decimals=0, *args, **kwargs):
return self.__constructor__(
query_compiler=self._query_compiler.round(decimals=decimals, **kwargs)
) | [
"Round each element in the DataFrame.\r\n\r\n Args:\r\n decimals: The number of decimals to round to.\r\n\r\n Returns:\r\n A new DataFrame.\r\n "
] |
Please provide a description of the function:def rpow(self, other, axis="columns", level=None, fill_value=None):
return self._binary_op(
"rpow", other, axis=axis, level=level, fill_value=fill_value
) | [
"Pow this DataFrame against another DataFrame/Series/scalar.\r\n\r\n Args:\r\n other: The object to use to apply the pow against this.\r\n axis: The axis to pow over.\r\n level: The Multilevel index level to apply pow over.\r\n fill_value: The value to fill NaNs wi... |
Please provide a description of the function:def rsub(self, other, axis="columns", level=None, fill_value=None):
return self._binary_op(
"rsub", other, axis=axis, level=level, fill_value=fill_value
) | [
"Subtract a DataFrame/Series/scalar from this DataFrame.\r\n\r\n Args:\r\n other: The object to use to apply the subtraction to this.\r\n axis: The axis to apply the subtraction over.\r\n level: Mutlilevel index level to subtract over.\r\n fill_value: The value to ... |
Please provide a description of the function:def rtruediv(self, other, axis="columns", level=None, fill_value=None):
return self._binary_op(
"rtruediv", other, axis=axis, level=level, fill_value=fill_value
) | [
"Div this DataFrame against another DataFrame/Series/scalar.\r\n\r\n Args:\r\n other: The object to use to apply the div against this.\r\n axis: The axis to div over.\r\n level: The Multilevel index level to apply div over.\r\n fill_value: The value to fill NaNs wi... |
Please provide a description of the function:def sample(
self,
n=None,
frac=None,
replace=False,
weights=None,
random_state=None,
axis=None,
):
axis = self._get_axis_number(axis) if axis is not None else 0
if axis:
... | [
"Returns a random sample of items from an axis of object.\r\n\r\n Args:\r\n n: Number of items from axis to return. Cannot be used with frac.\r\n Default = 1 if frac = None.\r\n frac: Fraction of axis items to return. Cannot be used with n.\r\n replace: Sample ... |
Please provide a description of the function:def set_axis(self, labels, axis=0, inplace=None):
if is_scalar(labels):
warnings.warn(
'set_axis now takes "labels" as first argument, and '
'"axis" as named parameter. The old form, with "axis" as '
... | [
"Assign desired index to given axis.\r\n\r\n Args:\r\n labels (pandas.Index or list-like): The Index to assign.\r\n axis (string or int): The axis to reassign.\r\n inplace (bool): Whether to make these modifications inplace.\r\n\r\n Returns:\r\n If inplace i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.