body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
def drop_duplicates(self, subset: Optional[Union[(Name, List[Name])]]=None, keep: Union[(bool, str)]='first', inplace: bool=False) -> Optional['DataFrame']: "\n Return DataFrame with duplicate rows removed, optionally only\n considering certain columns.\n\n Parameters\n ----------\n ...
-3,917,699,198,602,438,700
Return DataFrame with duplicate rows removed, optionally only considering certain columns. Parameters ---------- subset : column label or sequence of labels, optional Only consider certain columns for identifying duplicates, by default use all of the columns. keep : {'first', 'last', False}, default 'first' ...
python/pyspark/pandas/frame.py
drop_duplicates
Flyangz/spark
python
def drop_duplicates(self, subset: Optional[Union[(Name, List[Name])]]=None, keep: Union[(bool, str)]='first', inplace: bool=False) -> Optional['DataFrame']: "\n Return DataFrame with duplicate rows removed, optionally only\n considering certain columns.\n\n Parameters\n ----------\n ...
def reindex(self, labels: Optional[Sequence[Any]]=None, index: Optional[Union[('Index', Sequence[Any])]]=None, columns: Optional[Union[(pd.Index, Sequence[Any])]]=None, axis: Optional[Axis]=None, copy: Optional[bool]=True, fill_value: Optional[Any]=None) -> 'DataFrame': '\n Conform DataFrame to new index wit...
285,927,188,171,719,780
Conform DataFrame to new index with optional filling logic, placing NA/NaN in locations having no value in the previous index. A new object is produced unless the new index is equivalent to the current one and ``copy=False``. Parameters ---------- labels: array-like, optional New labels / index to conform the axis...
python/pyspark/pandas/frame.py
reindex
Flyangz/spark
python
def reindex(self, labels: Optional[Sequence[Any]]=None, index: Optional[Union[('Index', Sequence[Any])]]=None, columns: Optional[Union[(pd.Index, Sequence[Any])]]=None, axis: Optional[Axis]=None, copy: Optional[bool]=True, fill_value: Optional[Any]=None) -> 'DataFrame': '\n Conform DataFrame to new index wit...
def reindex_like(self, other: 'DataFrame', copy: bool=True) -> 'DataFrame': "\n Return a DataFrame with matching indices as other object.\n\n Conform the object to the same index on all axes. Places NA/NaN in locations\n having no value in the previous index. A new object is produced unless the...
7,742,307,885,276,616,000
Return a DataFrame with matching indices as other object. Conform the object to the same index on all axes. Places NA/NaN in locations having no value in the previous index. A new object is produced unless the new index is equivalent to the current one and copy=False. Parameters ---------- other : DataFrame Its r...
python/pyspark/pandas/frame.py
reindex_like
Flyangz/spark
python
def reindex_like(self, other: 'DataFrame', copy: bool=True) -> 'DataFrame': "\n Return a DataFrame with matching indices as other object.\n\n Conform the object to the same index on all axes. Places NA/NaN in locations\n having no value in the previous index. A new object is produced unless the...
def melt(self, id_vars: Optional[Union[(Name, List[Name])]]=None, value_vars: Optional[Union[(Name, List[Name])]]=None, var_name: Optional[Union[(str, List[str])]]=None, value_name: str='value') -> 'DataFrame': '\n Unpivot a DataFrame from wide format to long format, optionally\n leaving identifier va...
-6,052,788,158,713,160,000
Unpivot a DataFrame from wide format to long format, optionally leaving identifier variables set. This function is useful to massage a DataFrame into a format where one or more columns are identifier variables (`id_vars`), while all other columns, considered measured variables (`value_vars`), are "unpivoted" to the ro...
python/pyspark/pandas/frame.py
melt
Flyangz/spark
python
def melt(self, id_vars: Optional[Union[(Name, List[Name])]]=None, value_vars: Optional[Union[(Name, List[Name])]]=None, var_name: Optional[Union[(str, List[str])]]=None, value_name: str='value') -> 'DataFrame': '\n Unpivot a DataFrame from wide format to long format, optionally\n leaving identifier va...
def stack(self) -> DataFrameOrSeries: "\n Stack the prescribed level(s) from columns to index.\n\n Return a reshaped DataFrame or Series having a multi-level\n index with one or more new inner-most levels compared to the current\n DataFrame. The new inner-most levels are created by pivot...
9,052,999,775,344,987,000
Stack the prescribed level(s) from columns to index. Return a reshaped DataFrame or Series having a multi-level index with one or more new inner-most levels compared to the current DataFrame. The new inner-most levels are created by pivoting the columns of the current dataframe: - if the columns have a single level...
python/pyspark/pandas/frame.py
stack
Flyangz/spark
python
def stack(self) -> DataFrameOrSeries: "\n Stack the prescribed level(s) from columns to index.\n\n Return a reshaped DataFrame or Series having a multi-level\n index with one or more new inner-most levels compared to the current\n DataFrame. The new inner-most levels are created by pivot...
def unstack(self) -> DataFrameOrSeries: '\n Pivot the (necessarily hierarchical) index labels.\n\n Returns a DataFrame having a new level of column labels whose inner-most level\n consists of the pivoted index labels.\n\n If the index is not a MultiIndex, the output will be a Series.\n\n...
2,893,301,910,422,294,500
Pivot the (necessarily hierarchical) index labels. Returns a DataFrame having a new level of column labels whose inner-most level consists of the pivoted index labels. If the index is not a MultiIndex, the output will be a Series. .. note:: If the index is a MultiIndex, the output DataFrame could be very wide, and ...
python/pyspark/pandas/frame.py
unstack
Flyangz/spark
python
def unstack(self) -> DataFrameOrSeries: '\n Pivot the (necessarily hierarchical) index labels.\n\n Returns a DataFrame having a new level of column labels whose inner-most level\n consists of the pivoted index labels.\n\n If the index is not a MultiIndex, the output will be a Series.\n\n...
def all(self, axis: Axis=0, bool_only: Optional[bool]=None) -> 'Series': "\n Return whether all elements are True.\n\n Returns True unless there is at least one element within a series that is\n False or equivalent (e.g. zero or empty)\n\n Parameters\n ----------\n axis : {...
-349,392,930,906,440,600
Return whether all elements are True. Returns True unless there is at least one element within a series that is False or equivalent (e.g. zero or empty) Parameters ---------- axis : {0 or 'index'}, default 0 Indicate which axis or axes should be reduced. * 0 / 'index' : reduce the index, return a Series whos...
python/pyspark/pandas/frame.py
all
Flyangz/spark
python
def all(self, axis: Axis=0, bool_only: Optional[bool]=None) -> 'Series': "\n Return whether all elements are True.\n\n Returns True unless there is at least one element within a series that is\n False or equivalent (e.g. zero or empty)\n\n Parameters\n ----------\n axis : {...
def any(self, axis: Axis=0, bool_only: Optional[bool]=None) -> 'Series': "\n Return whether any element is True.\n\n Returns False unless there is at least one element within a series that is\n True or equivalent (e.g. non-zero or non-empty).\n\n Parameters\n ----------\n a...
5,382,438,178,177,989,000
Return whether any element is True. Returns False unless there is at least one element within a series that is True or equivalent (e.g. non-zero or non-empty). Parameters ---------- axis : {0 or 'index'}, default 0 Indicate which axis or axes should be reduced. * 0 / 'index' : reduce the index, return a Seri...
python/pyspark/pandas/frame.py
any
Flyangz/spark
python
def any(self, axis: Axis=0, bool_only: Optional[bool]=None) -> 'Series': "\n Return whether any element is True.\n\n Returns False unless there is at least one element within a series that is\n True or equivalent (e.g. non-zero or non-empty).\n\n Parameters\n ----------\n a...
def _bool_column_labels(self, column_labels: List[Label]) -> List[Label]: '\n Filter column labels of boolean columns (without None).\n ' bool_column_labels = [] for label in column_labels: psser = self._psser_for(label) if is_bool_dtype(psser): bool_column_labels.a...
-4,105,215,105,612,054,000
Filter column labels of boolean columns (without None).
python/pyspark/pandas/frame.py
_bool_column_labels
Flyangz/spark
python
def _bool_column_labels(self, column_labels: List[Label]) -> List[Label]: '\n \n ' bool_column_labels = [] for label in column_labels: psser = self._psser_for(label) if is_bool_dtype(psser): bool_column_labels.append(label) return bool_column_labels
def _result_aggregated(self, column_labels: List[Label], scols: List[Column]) -> 'Series': '\n Given aggregated Spark columns and respective column labels from the original\n pandas-on-Spark DataFrame, construct the result Series.\n ' from pyspark.pandas.series import first_series cols ...
-2,983,645,101,199,888,000
Given aggregated Spark columns and respective column labels from the original pandas-on-Spark DataFrame, construct the result Series.
python/pyspark/pandas/frame.py
_result_aggregated
Flyangz/spark
python
def _result_aggregated(self, column_labels: List[Label], scols: List[Column]) -> 'Series': '\n Given aggregated Spark columns and respective column labels from the original\n pandas-on-Spark DataFrame, construct the result Series.\n ' from pyspark.pandas.series import first_series cols ...
def rank(self, method: str='average', ascending: bool=True, numeric_only: Optional[bool]=None) -> 'DataFrame': "\n Compute numerical data ranks (1 through n) along axis. Equal values are\n assigned a rank that is the average of the ranks of those values.\n\n .. note:: the current implementation...
2,881,934,767,336,696,000
Compute numerical data ranks (1 through n) along axis. Equal values are assigned a rank that is the average of the ranks of those values. .. note:: the current implementation of rank uses Spark's Window without specifying partition specification. This leads to move all data into single partition in single mach...
python/pyspark/pandas/frame.py
rank
Flyangz/spark
python
def rank(self, method: str='average', ascending: bool=True, numeric_only: Optional[bool]=None) -> 'DataFrame': "\n Compute numerical data ranks (1 through n) along axis. Equal values are\n assigned a rank that is the average of the ranks of those values.\n\n .. note:: the current implementation...
def filter(self, items: Optional[Sequence[Any]]=None, like: Optional[str]=None, regex: Optional[str]=None, axis: Optional[Axis]=None) -> 'DataFrame': '\n Subset rows or columns of dataframe according to labels in\n the specified index.\n\n Note that this routine does not filter a dataframe on i...
8,439,502,228,821,004,000
Subset rows or columns of dataframe according to labels in the specified index. Note that this routine does not filter a dataframe on its contents. The filter is applied to the labels of the index. Parameters ---------- items : list-like Keep labels from axis which are in items. like : string Keep labels from...
python/pyspark/pandas/frame.py
filter
Flyangz/spark
python
def filter(self, items: Optional[Sequence[Any]]=None, like: Optional[str]=None, regex: Optional[str]=None, axis: Optional[Axis]=None) -> 'DataFrame': '\n Subset rows or columns of dataframe according to labels in\n the specified index.\n\n Note that this routine does not filter a dataframe on i...
def rename(self, mapper: Optional[Union[(Dict, Callable[([Any], Any)])]]=None, index: Optional[Union[(Dict, Callable[([Any], Any)])]]=None, columns: Optional[Union[(Dict, Callable[([Any], Any)])]]=None, axis: Axis='index', inplace: bool=False, level: Optional[int]=None, errors: str='ignore') -> Optional['DataFrame']: ...
4,436,174,056,561,670,000
Alter axes labels. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don’t throw an error. Parameters ---------- mapper : dict-like or function Dict-like or functions transformations to apply to that axis’ values. Use either `mapper`...
python/pyspark/pandas/frame.py
rename
Flyangz/spark
python
def rename(self, mapper: Optional[Union[(Dict, Callable[([Any], Any)])]]=None, index: Optional[Union[(Dict, Callable[([Any], Any)])]]=None, columns: Optional[Union[(Dict, Callable[([Any], Any)])]]=None, axis: Axis='index', inplace: bool=False, level: Optional[int]=None, errors: str='ignore') -> Optional['DataFrame']: ...
def rename_axis(self, mapper: Union[(Any, Sequence[Any], Dict[(Name, Any)], Callable[([Name], Any)])]=None, index: Union[(Any, Sequence[Any], Dict[(Name, Any)], Callable[([Name], Any)])]=None, columns: Union[(Any, Sequence[Any], Dict[(Name, Any)], Callable[([Name], Any)])]=None, axis: Optional[Axis]=0, inplace: Optiona...
-2,829,426,125,369,859,600
Set the name of the axis for the index or columns. Parameters ---------- mapper : scalar, list-like, optional A scalar, list-like, dict-like or functions transformations to apply to the axis name attribute. index, columns : scalar, list-like, dict-like or function, optional A scalar, list-like, dict-like o...
python/pyspark/pandas/frame.py
rename_axis
Flyangz/spark
python
def rename_axis(self, mapper: Union[(Any, Sequence[Any], Dict[(Name, Any)], Callable[([Name], Any)])]=None, index: Union[(Any, Sequence[Any], Dict[(Name, Any)], Callable[([Name], Any)])]=None, columns: Union[(Any, Sequence[Any], Dict[(Name, Any)], Callable[([Name], Any)])]=None, axis: Optional[Axis]=0, inplace: Optiona...
def keys(self) -> pd.Index: "\n Return alias for columns.\n\n Returns\n -------\n Index\n Columns of the DataFrame.\n\n Examples\n --------\n >>> df = ps.DataFrame([[1, 2], [4, 5], [7, 8]],\n ... index=['cobra', 'viper', 'sidewinde...
6,675,430,877,286,866,000
Return alias for columns. Returns ------- Index Columns of the DataFrame. Examples -------- >>> df = ps.DataFrame([[1, 2], [4, 5], [7, 8]], ... index=['cobra', 'viper', 'sidewinder'], ... columns=['max_speed', 'shield']) >>> df max_speed shield cobra ...
python/pyspark/pandas/frame.py
keys
Flyangz/spark
python
def keys(self) -> pd.Index: "\n Return alias for columns.\n\n Returns\n -------\n Index\n Columns of the DataFrame.\n\n Examples\n --------\n >>> df = ps.DataFrame([[1, 2], [4, 5], [7, 8]],\n ... index=['cobra', 'viper', 'sidewinde...
def pct_change(self, periods: int=1) -> 'DataFrame': "\n Percentage change between the current and a prior element.\n\n .. note:: the current implementation of this API uses Spark's Window without\n specifying partition specification. This leads to move all data into\n single par...
919,436,271,991,181,000
Percentage change between the current and a prior element. .. note:: the current implementation of this API uses Spark's Window without specifying partition specification. This leads to move all data into single partition in single machine and could cause serious performance degradation. Avoid this method ...
python/pyspark/pandas/frame.py
pct_change
Flyangz/spark
python
def pct_change(self, periods: int=1) -> 'DataFrame': "\n Percentage change between the current and a prior element.\n\n .. note:: the current implementation of this API uses Spark's Window without\n specifying partition specification. This leads to move all data into\n single par...
def idxmax(self, axis: Axis=0) -> 'Series': "\n Return index of first occurrence of maximum over requested axis.\n NA/null values are excluded.\n\n .. note:: This API collect all rows with maximum value using `to_pandas()`\n because we suppose the number of rows with max values are u...
5,427,617,348,550,696,000
Return index of first occurrence of maximum over requested axis. NA/null values are excluded. .. note:: This API collect all rows with maximum value using `to_pandas()` because we suppose the number of rows with max values are usually small in general. Parameters ---------- axis : 0 or 'index' Can only be set...
python/pyspark/pandas/frame.py
idxmax
Flyangz/spark
python
def idxmax(self, axis: Axis=0) -> 'Series': "\n Return index of first occurrence of maximum over requested axis.\n NA/null values are excluded.\n\n .. note:: This API collect all rows with maximum value using `to_pandas()`\n because we suppose the number of rows with max values are u...
def idxmin(self, axis: Axis=0) -> 'Series': "\n Return index of first occurrence of minimum over requested axis.\n NA/null values are excluded.\n\n .. note:: This API collect all rows with minimum value using `to_pandas()`\n because we suppose the number of rows with min values are u...
3,556,289,599,252,744,000
Return index of first occurrence of minimum over requested axis. NA/null values are excluded. .. note:: This API collect all rows with minimum value using `to_pandas()` because we suppose the number of rows with min values are usually small in general. Parameters ---------- axis : 0 or 'index' Can only be set...
python/pyspark/pandas/frame.py
idxmin
Flyangz/spark
python
def idxmin(self, axis: Axis=0) -> 'Series': "\n Return index of first occurrence of minimum over requested axis.\n NA/null values are excluded.\n\n .. note:: This API collect all rows with minimum value using `to_pandas()`\n because we suppose the number of rows with min values are u...
def info(self, verbose: Optional[bool]=None, buf: Optional[IO[str]]=None, max_cols: Optional[int]=None, null_counts: Optional[bool]=None) -> None: '\n Print a concise summary of a DataFrame.\n\n This method prints information about a DataFrame including\n the index dtype and column dtypes, non-...
-6,592,994,989,138,733,000
Print a concise summary of a DataFrame. This method prints information about a DataFrame including the index dtype and column dtypes, non-null values and memory usage. Parameters ---------- verbose : bool, optional Whether to print the full summary. buf : writable buffer, defaults to sys.stdout Where to send ...
python/pyspark/pandas/frame.py
info
Flyangz/spark
python
def info(self, verbose: Optional[bool]=None, buf: Optional[IO[str]]=None, max_cols: Optional[int]=None, null_counts: Optional[bool]=None) -> None: '\n Print a concise summary of a DataFrame.\n\n This method prints information about a DataFrame including\n the index dtype and column dtypes, non-...
def quantile(self, q: Union[(float, Iterable[float])]=0.5, axis: Axis=0, numeric_only: bool=True, accuracy: int=10000) -> DataFrameOrSeries: "\n Return value at the given quantile.\n\n .. note:: Unlike pandas', the quantile in pandas-on-Spark is an approximated quantile\n based upon approxi...
-3,218,161,924,381,842,000
Return value at the given quantile. .. note:: Unlike pandas', the quantile in pandas-on-Spark is an approximated quantile based upon approximate percentile computation because computing quantile across a large dataset is extremely expensive. Parameters ---------- q : float or array-like, default 0.5 (50% quan...
python/pyspark/pandas/frame.py
quantile
Flyangz/spark
python
def quantile(self, q: Union[(float, Iterable[float])]=0.5, axis: Axis=0, numeric_only: bool=True, accuracy: int=10000) -> DataFrameOrSeries: "\n Return value at the given quantile.\n\n .. note:: Unlike pandas', the quantile in pandas-on-Spark is an approximated quantile\n based upon approxi...
def query(self, expr: str, inplace: bool=False) -> Optional['DataFrame']: "\n Query the columns of a DataFrame with a boolean expression.\n\n .. note:: Internal columns that starting with a '__' prefix are able to access, however,\n they are not supposed to be accessed.\n\n .. note::...
4,015,551,663,124,263,400
Query the columns of a DataFrame with a boolean expression. .. note:: Internal columns that starting with a '__' prefix are able to access, however, they are not supposed to be accessed. .. note:: This API delegates to Spark SQL so the syntax follows Spark SQL. Therefore, the pandas specific syntax such as `@...
python/pyspark/pandas/frame.py
query
Flyangz/spark
python
def query(self, expr: str, inplace: bool=False) -> Optional['DataFrame']: "\n Query the columns of a DataFrame with a boolean expression.\n\n .. note:: Internal columns that starting with a '__' prefix are able to access, however,\n they are not supposed to be accessed.\n\n .. note::...
def take(self, indices: List[int], axis: Axis=0, **kwargs: Any) -> 'DataFrame': "\n Return the elements in the given *positional* indices along an axis.\n\n This means that we are not indexing according to actual values in\n the index attribute of the object. We are indexing according to the\n ...
8,431,998,034,869,836,000
Return the elements in the given *positional* indices along an axis. This means that we are not indexing according to actual values in the index attribute of the object. We are indexing according to the actual position of the element in the object. Parameters ---------- indices : array-like An array of ints indic...
python/pyspark/pandas/frame.py
take
Flyangz/spark
python
def take(self, indices: List[int], axis: Axis=0, **kwargs: Any) -> 'DataFrame': "\n Return the elements in the given *positional* indices along an axis.\n\n This means that we are not indexing according to actual values in\n the index attribute of the object. We are indexing according to the\n ...
def eval(self, expr: str, inplace: bool=False) -> Optional[DataFrameOrSeries]: "\n Evaluate a string describing operations on DataFrame columns.\n\n Operates on columns only, not specific rows or elements. This allows\n `eval` to run arbitrary code, which can make you vulnerable to code\n ...
-2,884,725,735,896,062,000
Evaluate a string describing operations on DataFrame columns. Operates on columns only, not specific rows or elements. This allows `eval` to run arbitrary code, which can make you vulnerable to code injection if you pass user input to this function. Parameters ---------- expr : str The expression string to evalua...
python/pyspark/pandas/frame.py
eval
Flyangz/spark
python
def eval(self, expr: str, inplace: bool=False) -> Optional[DataFrameOrSeries]: "\n Evaluate a string describing operations on DataFrame columns.\n\n Operates on columns only, not specific rows or elements. This allows\n `eval` to run arbitrary code, which can make you vulnerable to code\n ...
def explode(self, column: Name) -> 'DataFrame': "\n Transform each element of a list-like to a row, replicating index values.\n\n Parameters\n ----------\n column : str or tuple\n Column to explode.\n\n Returns\n -------\n DataFrame\n Exploded l...
7,501,693,200,103,724,000
Transform each element of a list-like to a row, replicating index values. Parameters ---------- column : str or tuple Column to explode. Returns ------- DataFrame Exploded lists to rows of the subset columns; index will be duplicated for these rows. See Also -------- DataFrame.unstack : Pivot a level of ...
python/pyspark/pandas/frame.py
explode
Flyangz/spark
python
def explode(self, column: Name) -> 'DataFrame': "\n Transform each element of a list-like to a row, replicating index values.\n\n Parameters\n ----------\n column : str or tuple\n Column to explode.\n\n Returns\n -------\n DataFrame\n Exploded l...
def mad(self, axis: Axis=0) -> 'Series': "\n Return the mean absolute deviation of values.\n\n Parameters\n ----------\n axis : {index (0), columns (1)}\n Axis for the function to be applied on.\n\n Examples\n --------\n >>> df = ps.DataFrame({'a': [1, 2, ...
5,261,953,540,311,855,000
Return the mean absolute deviation of values. Parameters ---------- axis : {index (0), columns (1)} Axis for the function to be applied on. Examples -------- >>> df = ps.DataFrame({'a': [1, 2, 3, np.nan], 'b': [0.1, 0.2, 0.3, np.nan]}, ... columns=['a', 'b']) >>> df.mad() a 0.666667 b 0.0...
python/pyspark/pandas/frame.py
mad
Flyangz/spark
python
def mad(self, axis: Axis=0) -> 'Series': "\n Return the mean absolute deviation of values.\n\n Parameters\n ----------\n axis : {index (0), columns (1)}\n Axis for the function to be applied on.\n\n Examples\n --------\n >>> df = ps.DataFrame({'a': [1, 2, ...
def tail(self, n: int=5) -> 'DataFrame': "\n Return the last `n` rows.\n\n This function returns last `n` rows from the object based on\n position. It is useful for quickly verifying data, for example,\n after sorting or appending rows.\n\n For negative values of `n`, this functio...
-381,023,855,042,304,900
Return the last `n` rows. This function returns last `n` rows from the object based on position. It is useful for quickly verifying data, for example, after sorting or appending rows. For negative values of `n`, this function returns all rows except the first `n` rows, equivalent to ``df[n:]``. Parameters ----------...
python/pyspark/pandas/frame.py
tail
Flyangz/spark
python
def tail(self, n: int=5) -> 'DataFrame': "\n Return the last `n` rows.\n\n This function returns last `n` rows from the object based on\n position. It is useful for quickly verifying data, for example,\n after sorting or appending rows.\n\n For negative values of `n`, this functio...
def align(self, other: DataFrameOrSeries, join: str='outer', axis: Optional[Axis]=None, copy: bool=True) -> Tuple[('DataFrame', DataFrameOrSeries)]: '\n Align two objects on their axes with the specified join method.\n\n Join method is specified for each axis Index.\n\n Parameters\n ----...
436,715,312,717,442,240
Align two objects on their axes with the specified join method. Join method is specified for each axis Index. Parameters ---------- other : DataFrame or Series join : {{'outer', 'inner', 'left', 'right'}}, default 'outer' axis : allowed axis of the other object, default None Align on index (0), columns (1), or bo...
python/pyspark/pandas/frame.py
align
Flyangz/spark
python
def align(self, other: DataFrameOrSeries, join: str='outer', axis: Optional[Axis]=None, copy: bool=True) -> Tuple[('DataFrame', DataFrameOrSeries)]: '\n Align two objects on their axes with the specified join method.\n\n Join method is specified for each axis Index.\n\n Parameters\n ----...
@staticmethod def from_dict(data: Dict[(Name, Sequence[Any])], orient: str='columns', dtype: Union[(str, Dtype)]=None, columns: Optional[List[Name]]=None) -> 'DataFrame': '\n Construct DataFrame from dict of array-like or dicts.\n\n Creates DataFrame object from dictionary by columns or by index\n ...
-6,497,009,801,001,677,000
Construct DataFrame from dict of array-like or dicts. Creates DataFrame object from dictionary by columns or by index allowing dtype specification. Parameters ---------- data : dict Of the form {field : array-like} or {field : dict}. orient : {'columns', 'index'}, default 'columns' The "orientation" of the da...
python/pyspark/pandas/frame.py
from_dict
Flyangz/spark
python
@staticmethod def from_dict(data: Dict[(Name, Sequence[Any])], orient: str='columns', dtype: Union[(str, Dtype)]=None, columns: Optional[List[Name]]=None) -> 'DataFrame': '\n Construct DataFrame from dict of array-like or dicts.\n\n Creates DataFrame object from dictionary by columns or by index\n ...
def _to_internal_pandas(self) -> pd.DataFrame: '\n Return a pandas DataFrame directly from _internal to avoid overhead of copy.\n\n This method is for internal use only.\n ' return self._internal.to_pandas_frame
-1,994,076,103,929,380,600
Return a pandas DataFrame directly from _internal to avoid overhead of copy. This method is for internal use only.
python/pyspark/pandas/frame.py
_to_internal_pandas
Flyangz/spark
python
def _to_internal_pandas(self) -> pd.DataFrame: '\n Return a pandas DataFrame directly from _internal to avoid overhead of copy.\n\n This method is for internal use only.\n ' return self._internal.to_pandas_frame
@staticmethod def _index_normalized_label(level: int, labels: Union[(Name, Sequence[Name])]) -> List[Label]: '\n Returns a label that is normalized against the current column index level.\n For example, the key "abc" can be ("abc", "", "") if the current Frame has\n a multi-index for its column...
3,790,296,275,256,254,000
Returns a label that is normalized against the current column index level. For example, the key "abc" can be ("abc", "", "") if the current Frame has a multi-index for its column
python/pyspark/pandas/frame.py
_index_normalized_label
Flyangz/spark
python
@staticmethod def _index_normalized_label(level: int, labels: Union[(Name, Sequence[Name])]) -> List[Label]: '\n Returns a label that is normalized against the current column index level.\n For example, the key "abc" can be ("abc", , ) if the current Frame has\n a multi-index for its column\n ...
@staticmethod def _index_normalized_frame(level: int, psser_or_psdf: DataFrameOrSeries) -> 'DataFrame': '\n Returns a frame that is normalized against the current column index level.\n For example, the name in `pd.Series([...], name="abc")` can be can be\n ("abc", "", "") if the current DataFra...
4,519,135,396,839,812,600
Returns a frame that is normalized against the current column index level. For example, the name in `pd.Series([...], name="abc")` can be can be ("abc", "", "") if the current DataFrame has a multi-index for its column
python/pyspark/pandas/frame.py
_index_normalized_frame
Flyangz/spark
python
@staticmethod def _index_normalized_frame(level: int, psser_or_psdf: DataFrameOrSeries) -> 'DataFrame': '\n Returns a frame that is normalized against the current column index level.\n For example, the name in `pd.Series([...], name="abc")` can be can be\n ("abc", , ) if the current DataFrame h...
@export def display_timeline(data: Union[(pd.DataFrame, dict)], time_column: str='TimeGenerated', source_columns: list=None, **kwargs) -> figure: '\n Display a timeline of events.\n\n Parameters\n ----------\n data : Union[dict, pd.DataFrame]\n Either\n dict of data sets to plot on the tim...
5,080,413,146,164,393,000
Display a timeline of events. Parameters ---------- data : Union[dict, pd.DataFrame] Either dict of data sets to plot on the timeline with the following structure:: Key (str) - Name of data set to be displayed in legend Value (Dict[str, Any]) - containing: data (pd.DataFrame) - Dat...
msticpy/nbtools/timeline.py
display_timeline
Dqirvin/msticpy
python
@export def display_timeline(data: Union[(pd.DataFrame, dict)], time_column: str='TimeGenerated', source_columns: list=None, **kwargs) -> figure: '\n Display a timeline of events.\n\n Parameters\n ----------\n data : Union[dict, pd.DataFrame]\n Either\n dict of data sets to plot on the tim...
@export def display_timeline_values(data: pd.DataFrame, y: str, time_column: str='TimeGenerated', source_columns: list=None, **kwargs) -> figure: '\n Display a timeline of events.\n\n Parameters\n ----------\n data : pd.DataFrame\n DataFrame as a single data set or grouped into individual\n ...
6,533,993,632,519,709,000
Display a timeline of events. Parameters ---------- data : pd.DataFrame DataFrame as a single data set or grouped into individual plot series using the `group_by` parameter time_column : str, optional Name of the timestamp column (the default is 'TimeGenerated') y : str The column name holding the ...
msticpy/nbtools/timeline.py
display_timeline_values
Dqirvin/msticpy
python
@export def display_timeline_values(data: pd.DataFrame, y: str, time_column: str='TimeGenerated', source_columns: list=None, **kwargs) -> figure: '\n Display a timeline of events.\n\n Parameters\n ----------\n data : pd.DataFrame\n DataFrame as a single data set or grouped into individual\n ...
def _display_timeline_dict(data: dict, **kwargs) -> figure: "\n Display a timeline of events.\n\n Parameters\n ----------\n data : dict\n Data points to plot on the timeline.\n Need to contain:\n Key - Name of data type to be displayed in legend\n Value - ...
8,766,972,964,578,907,000
Display a timeline of events. Parameters ---------- data : dict Data points to plot on the timeline. Need to contain: Key - Name of data type to be displayed in legend Value - dict of data containing: data : pd.DataFrame Data to plot ...
msticpy/nbtools/timeline.py
_display_timeline_dict
Dqirvin/msticpy
python
def _display_timeline_dict(data: dict, **kwargs) -> figure: "\n Display a timeline of events.\n\n Parameters\n ----------\n data : dict\n Data points to plot on the timeline.\n Need to contain:\n Key - Name of data type to be displayed in legend\n Value - ...
def _get_ref_event_time(**kwargs) -> Tuple[(datetime, str)]: 'Extract the reference time from kwargs.' ref_alert = kwargs.get('alert', None) if (ref_alert is not None): ref_event = ref_alert ref_label = 'Alert time' else: ref_event = kwargs.get('ref_event', None) ref_labe...
502,102,706,645,366,100
Extract the reference time from kwargs.
msticpy/nbtools/timeline.py
_get_ref_event_time
Dqirvin/msticpy
python
def _get_ref_event_time(**kwargs) -> Tuple[(datetime, str)]: ref_alert = kwargs.get('alert', None) if (ref_alert is not None): ref_event = ref_alert ref_label = 'Alert time' else: ref_event = kwargs.get('ref_event', None) ref_label = 'Event time' if (ref_event is not...
def _plot_dict_series(data, plot, legend_pos): 'Plot series from dict.' legend_items = [] for (ser_name, series_def) in data.items(): if (legend_pos == 'inline'): p_series = plot.diamond(x=series_def['time_column'], y='y_index', color=series_def['color'], alpha=0.5, size=10, source=serie...
7,726,691,837,423,861,000
Plot series from dict.
msticpy/nbtools/timeline.py
_plot_dict_series
Dqirvin/msticpy
python
def _plot_dict_series(data, plot, legend_pos): legend_items = [] for (ser_name, series_def) in data.items(): if (legend_pos == 'inline'): p_series = plot.diamond(x=series_def['time_column'], y='y_index', color=series_def['color'], alpha=0.5, size=10, source=series_def['source'], legend_...
def _wrap_df_columns(data: pd.DataFrame, wrap_len: int=50): 'Wrap any string columns.' if (not data.empty): for col in data.columns: if isinstance(data[col].iloc[0], str): data[col] = data[col].str.wrap(wrap_len)
647,050,524,434,827,400
Wrap any string columns.
msticpy/nbtools/timeline.py
_wrap_df_columns
Dqirvin/msticpy
python
def _wrap_df_columns(data: pd.DataFrame, wrap_len: int=50): if (not data.empty): for col in data.columns: if isinstance(data[col].iloc[0], str): data[col] = data[col].str.wrap(wrap_len)
def _get_tick_formatter() -> DatetimeTickFormatter: 'Return tick formatting for different zoom levels.' tick_format = DatetimeTickFormatter() tick_format.days = ['%m-%d %H:%M'] tick_format.hours = ['%H:%M:%S'] tick_format.minutes = ['%H:%M:%S'] tick_format.seconds = ['%H:%M:%S'] tick_format....
6,239,954,124,480,516,000
Return tick formatting for different zoom levels.
msticpy/nbtools/timeline.py
_get_tick_formatter
Dqirvin/msticpy
python
def _get_tick_formatter() -> DatetimeTickFormatter: tick_format = DatetimeTickFormatter() tick_format.days = ['%m-%d %H:%M'] tick_format.hours = ['%H:%M:%S'] tick_format.minutes = ['%H:%M:%S'] tick_format.seconds = ['%H:%M:%S'] tick_format.milliseconds = ['%H:%M:%S.%3N'] return tick_for...
def _calc_auto_plot_height(group_count): 'Dynamic calculation of plot height.' ht_per_row = 40 if (group_count > 15): ht_per_row = 25 return max((ht_per_row * group_count), 300)
2,604,020,579,015,324,700
Dynamic calculation of plot height.
msticpy/nbtools/timeline.py
_calc_auto_plot_height
Dqirvin/msticpy
python
def _calc_auto_plot_height(group_count): ht_per_row = 40 if (group_count > 15): ht_per_row = 25 return max((ht_per_row * group_count), 300)
def _create_range_tool(data, min_time, max_time, plot_range, width, height, time_column: str=None): 'Create plot bar to act as as range selector.' ext_min = (min_time - ((max_time - min_time) * 0.15)) ext_max = (max_time + ((max_time - min_time) * 0.15)) plot_height = max(120, int((height * 0.2))) r...
7,389,459,447,783,332,000
Create plot bar to act as as range selector.
msticpy/nbtools/timeline.py
_create_range_tool
Dqirvin/msticpy
python
def _create_range_tool(data, min_time, max_time, plot_range, width, height, time_column: str=None): ext_min = (min_time - ((max_time - min_time) * 0.15)) ext_max = (max_time + ((max_time - min_time) * 0.15)) plot_height = max(120, int((height * 0.2))) rng_select = figure(x_range=(ext_min, ext_max),...
def _add_ref_line(plot, ref_time, ref_text='Ref time', series_count=1): 'Add a reference marker line and label at `ref_time`.' ref_label_tm = pd.Timestamp(ref_time) plot.line(x=[ref_label_tm, ref_label_tm], y=[0, series_count]) ref_label = Label(x=ref_label_tm, y=0, y_offset=10, x_units='data', y_units=...
5,033,550,887,243,387,000
Add a reference marker line and label at `ref_time`.
msticpy/nbtools/timeline.py
_add_ref_line
Dqirvin/msticpy
python
def _add_ref_line(plot, ref_time, ref_text='Ref time', series_count=1): ref_label_tm = pd.Timestamp(ref_time) plot.line(x=[ref_label_tm, ref_label_tm], y=[0, series_count]) ref_label = Label(x=ref_label_tm, y=0, y_offset=10, x_units='data', y_units='data', text=f'< {ref_text}', text_font_size='8pt', re...
def render_form(self, *args, **kwargs): 'Placeholder for Wagtail < 2.13' return ''
-8,506,567,350,089,177,000
Placeholder for Wagtail < 2.13
wagtail_localize/test/models.py
render_form
dinoperovic/wagtail-localize
python
def render_form(self, *args, **kwargs): return
def filtermultiport(ips): 'Filter out hosts with more nodes per IP' hist = collections.defaultdict(list) for ip in ips: hist[ip['sortkey']].append(ip) return [value[0] for (key, value) in list(hist.items()) if (len(value) == 1)]
6,911,170,735,548,327,000
Filter out hosts with more nodes per IP
contrib/seeds/makeseeds.py
filtermultiport
BitHostCoin/BitHost
python
def filtermultiport(ips): hist = collections.defaultdict(list) for ip in ips: hist[ip['sortkey']].append(ip) return [value[0] for (key, value) in list(hist.items()) if (len(value) == 1)]
def test_next_must_pass(self): "\n Kathy and Tom each have face cards, tom just played and the total is at 30\n\n Expected: It is now kathy's turn and she must pass\n " fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'hands': {'kathy': ['5e1e7e60ab'], 'tom': ['95f92b2f0c...
-4,560,224,086,035,091,000
Kathy and Tom each have face cards, tom just played and the total is at 30 Expected: It is now kathy's turn and she must pass
cribbage/app/tests/test_bev.py
test_next_must_pass
zachcalvert/card-games
python
def test_next_must_pass(self): "\n Kathy and Tom each have face cards, tom just played and the total is at 30\n\n Expected: It is now kathy's turn and she must pass\n " fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'hands': {'kathy': ['5e1e7e60ab'], 'tom': ['95f92b2f0c...
def test_next_must_play(self): "\n Kathy and Tom each have aces. Tom just played and the total is at 30\n\n Expected: It is now kathy's turn and she must play\n " fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'hands': {'kathy': ['EXAMPLE_KEY'], 'tom': ['ace1293f8a']}, ...
-4,929,694,881,815,937,000
Kathy and Tom each have aces. Tom just played and the total is at 30 Expected: It is now kathy's turn and she must play
cribbage/app/tests/test_bev.py
test_next_must_play
zachcalvert/card-games
python
def test_next_must_play(self): "\n Kathy and Tom each have aces. Tom just played and the total is at 30\n\n Expected: It is now kathy's turn and she must play\n " fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'hands': {'kathy': ['EXAMPLE_KEY'], 'tom': ['ace1293f8a']}, ...
def test_everyone_has_passed_and_tom_cant_play_again_this_round(self): "\n Kathy and Tom each have face cards, kathy just passed and the total is at 30\n\n Expected: It is Tom's turn and he must pass.\n " fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'hands': {'kathy':...
-6,701,485,922,209,635,000
Kathy and Tom each have face cards, kathy just passed and the total is at 30 Expected: It is Tom's turn and he must pass.
cribbage/app/tests/test_bev.py
test_everyone_has_passed_and_tom_cant_play_again_this_round
zachcalvert/card-games
python
def test_everyone_has_passed_and_tom_cant_play_again_this_round(self): "\n Kathy and Tom each have face cards, kathy just passed and the total is at 30\n\n Expected: It is Tom's turn and he must pass.\n " fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'hands': {'kathy':...
def test_everyone_else_has_passed_and_tom_can_play_again_this_round(self): "\n Tom has an Ace, kathy just passed and the total is at 30\n\n Expected: It is now Tom's turn to play, he does not receive a point for go\n " fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'han...
541,724,108,961,516,740
Tom has an Ace, kathy just passed and the total is at 30 Expected: It is now Tom's turn to play, he does not receive a point for go
cribbage/app/tests/test_bev.py
test_everyone_else_has_passed_and_tom_can_play_again_this_round
zachcalvert/card-games
python
def test_everyone_else_has_passed_and_tom_can_play_again_this_round(self): "\n Tom has an Ace, kathy just passed and the total is at 30\n\n Expected: It is now Tom's turn to play, he does not receive a point for go\n " fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'han...
def test_kathy_hit_thirtyone_still_has_cards(self): '\n Kathy just hit 31, and still has cards\n\n Expected: no new points for kathy, and its her turn with a fresh pegging area\n ' fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'hands': {'kathy': ['5e1e7e60ab'], 'tom': ...
-137,440,574,099,362,750
Kathy just hit 31, and still has cards Expected: no new points for kathy, and its her turn with a fresh pegging area
cribbage/app/tests/test_bev.py
test_kathy_hit_thirtyone_still_has_cards
zachcalvert/card-games
python
def test_kathy_hit_thirtyone_still_has_cards(self): '\n Kathy just hit 31, and still has cards\n\n Expected: no new points for kathy, and its her turn with a fresh pegging area\n ' fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'hands': {'kathy': ['5e1e7e60ab'], 'tom': ...
def test_kathy_hit_thirtyone_has_no_cards_left_and_others_do(self): "\n Kathy just hit 31, and has no cards left. Tom has a card left\n\n Expected: no new points for kathy, and its now Tom's turn with a fresh pegging area\n " fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARD...
-2,291,250,625,859,228,000
Kathy just hit 31, and has no cards left. Tom has a card left Expected: no new points for kathy, and its now Tom's turn with a fresh pegging area
cribbage/app/tests/test_bev.py
test_kathy_hit_thirtyone_has_no_cards_left_and_others_do
zachcalvert/card-games
python
def test_kathy_hit_thirtyone_has_no_cards_left_and_others_do(self): "\n Kathy just hit 31, and has no cards left. Tom has a card left\n\n Expected: no new points for kathy, and its now Tom's turn with a fresh pegging area\n " fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARD...
def test_player_hit_thirtyone_and_no_one_has_cards_left(self): '\n Kathy just hit 31, and everyone is out of cards\n\n Expected: no new points for kathy, and it is now time to score hands\n ' fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'first_to_score': 'tom', 'hands...
-749,672,507,504,275,300
Kathy just hit 31, and everyone is out of cards Expected: no new points for kathy, and it is now time to score hands
cribbage/app/tests/test_bev.py
test_player_hit_thirtyone_and_no_one_has_cards_left
zachcalvert/card-games
python
def test_player_hit_thirtyone_and_no_one_has_cards_left(self): '\n Kathy just hit 31, and everyone is out of cards\n\n Expected: no new points for kathy, and it is now time to score hands\n ' fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'first_to_score': 'tom', 'hands...
@mock.patch('app.award_points', mock.MagicMock(return_value=True)) def test_no_one_has_cards_left(self): '\n Kathy just hit 24, and everyone is out of cards\n\n Expected: Kathy gets 1 point for go, and it is now time to score hands\n ' fake_redis = fakeredis.FakeRedis() game_dict = {'ca...
8,366,143,360,917,596,000
Kathy just hit 24, and everyone is out of cards Expected: Kathy gets 1 point for go, and it is now time to score hands
cribbage/app/tests/test_bev.py
test_no_one_has_cards_left
zachcalvert/card-games
python
@mock.patch('app.award_points', mock.MagicMock(return_value=True)) def test_no_one_has_cards_left(self): '\n Kathy just hit 24, and everyone is out of cards\n\n Expected: Kathy gets 1 point for go, and it is now time to score hands\n ' fake_redis = fakeredis.FakeRedis() game_dict = {'ca...
@mock.patch('app.award_points', mock.MagicMock(return_value=False)) def test_thirtyone(self): '\n Verify two points for 31\n ' fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'hands': {'kathy': ['EXAMPLE_KEY', 'c6f4900f82'], 'tom': ['ace1293f8a']}, 'pegging': {'cards': ['4de6b7...
-6,152,835,974,117,221,000
Verify two points for 31
cribbage/app/tests/test_bev.py
test_thirtyone
zachcalvert/card-games
python
@mock.patch('app.award_points', mock.MagicMock(return_value=False)) def test_thirtyone(self): '\n \n ' fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'hands': {'kathy': ['EXAMPLE_KEY', 'c6f4900f82'], 'tom': ['ace1293f8a']}, 'pegging': {'cards': ['4de6b73ab8', 'f6571e162f', 'c8...
@mock.patch('app.award_points', mock.MagicMock(return_value=False)) def test_run_of_three(self): '\n test run of three scores three points\n ' fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'hands': {'kathy': ['EXAMPLE_KEY', 'c6f4900f82'], 'tom': ['ace1293f8a']}, 'pegging': {'...
8,995,552,579,221,174,000
test run of three scores three points
cribbage/app/tests/test_bev.py
test_run_of_three
zachcalvert/card-games
python
@mock.patch('app.award_points', mock.MagicMock(return_value=False)) def test_run_of_three(self): '\n \n ' fake_redis = fakeredis.FakeRedis() game_dict = {'cards': CARDS, 'hands': {'kathy': ['EXAMPLE_KEY', 'c6f4900f82'], 'tom': ['ace1293f8a']}, 'pegging': {'cards': ['4de6b73ab8', 'c88523b677'],...
def equals(self, other: Any) -> bool: '\n Determines if two Index objects contain the same elements.\n ' if self.is_(other): return True if (not isinstance(other, Index)): return False elif (other.dtype.kind in ['f', 'i', 'u', 'c']): return False elif (not isins...
-8,305,807,658,120,672,000
Determines if two Index objects contain the same elements.
pandas/core/indexes/datetimelike.py
equals
DiligentDolphin/pandas
python
def equals(self, other: Any) -> bool: '\n \n ' if self.is_(other): return True if (not isinstance(other, Index)): return False elif (other.dtype.kind in ['f', 'i', 'u', 'c']): return False elif (not isinstance(other, type(self))): should_try = False ...
def format(self, name: bool=False, formatter: (Callable | None)=None, na_rep: str='NaT', date_format: (str | None)=None) -> list[str]: '\n Render a string representation of the Index.\n ' header = [] if name: header.append((ibase.pprint_thing(self.name, escape_chars=('\t', '\r', '\n'))...
8,713,305,425,244,024,000
Render a string representation of the Index.
pandas/core/indexes/datetimelike.py
format
DiligentDolphin/pandas
python
def format(self, name: bool=False, formatter: (Callable | None)=None, na_rep: str='NaT', date_format: (str | None)=None) -> list[str]: '\n \n ' header = [] if name: header.append((ibase.pprint_thing(self.name, escape_chars=('\t', '\r', '\n')) if (self.name is not None) else )) if (...
def _format_attrs(self): '\n Return a list of tuples of the (attr,formatted_value).\n ' attrs = super()._format_attrs() for attrib in self._attributes: if (attrib == 'freq'): freq = self.freqstr if (freq is not None): freq = repr(freq) ...
4,205,978,032,163,911,700
Return a list of tuples of the (attr,formatted_value).
pandas/core/indexes/datetimelike.py
_format_attrs
DiligentDolphin/pandas
python
def _format_attrs(self): '\n \n ' attrs = super()._format_attrs() for attrib in self._attributes: if (attrib == 'freq'): freq = self.freqstr if (freq is not None): freq = repr(freq) attrs.append(('freq', freq)) return attrs
@final def _partial_date_slice(self, reso: Resolution, parsed: datetime): '\n Parameters\n ----------\n reso : Resolution\n parsed : datetime\n\n Returns\n -------\n slice or ndarray[intp]\n ' if (not self._can_partial_date_slice(reso)): raise Valu...
2,203,640,350,825,362,400
Parameters ---------- reso : Resolution parsed : datetime Returns ------- slice or ndarray[intp]
pandas/core/indexes/datetimelike.py
_partial_date_slice
DiligentDolphin/pandas
python
@final def _partial_date_slice(self, reso: Resolution, parsed: datetime): '\n Parameters\n ----------\n reso : Resolution\n parsed : datetime\n\n Returns\n -------\n slice or ndarray[intp]\n ' if (not self._can_partial_date_slice(reso)): raise Valu...
def _maybe_cast_slice_bound(self, label, side: str, kind=lib.no_default): "\n If label is a string, cast it to scalar type according to resolution.\n\n Parameters\n ----------\n label : object\n side : {'left', 'right'}\n kind : {'loc', 'getitem'} or None\n\n Returns...
-7,072,608,151,381,606,000
If label is a string, cast it to scalar type according to resolution. Parameters ---------- label : object side : {'left', 'right'} kind : {'loc', 'getitem'} or None Returns ------- label : object Notes ----- Value of `side` parameter should be validated in caller.
pandas/core/indexes/datetimelike.py
_maybe_cast_slice_bound
DiligentDolphin/pandas
python
def _maybe_cast_slice_bound(self, label, side: str, kind=lib.no_default): "\n If label is a string, cast it to scalar type according to resolution.\n\n Parameters\n ----------\n label : object\n side : {'left', 'right'}\n kind : {'loc', 'getitem'} or None\n\n Returns...
def shift(self: _T, periods: int=1, freq=None) -> _T: "\n Shift index by desired number of time frequency increments.\n\n This method is for shifting the values of datetime-like indexes\n by a specified time increment a given number of times.\n\n Parameters\n ----------\n p...
-8,632,447,863,693,839,000
Shift index by desired number of time frequency increments. This method is for shifting the values of datetime-like indexes by a specified time increment a given number of times. Parameters ---------- periods : int, default 1 Number of periods (or increments) to shift by, can be positive or negative. freq : p...
pandas/core/indexes/datetimelike.py
shift
DiligentDolphin/pandas
python
def shift(self: _T, periods: int=1, freq=None) -> _T: "\n Shift index by desired number of time frequency increments.\n\n This method is for shifting the values of datetime-like indexes\n by a specified time increment a given number of times.\n\n Parameters\n ----------\n p...
def _intersection(self, other: Index, sort=False) -> Index: '\n intersection specialized to the case with matching dtypes and both non-empty.\n ' other = cast('DatetimeTimedeltaMixin', other) if self._can_range_setop(other): return self._range_intersect(other, sort=sort) if (not se...
-2,951,834,144,288,449,000
intersection specialized to the case with matching dtypes and both non-empty.
pandas/core/indexes/datetimelike.py
_intersection
DiligentDolphin/pandas
python
def _intersection(self, other: Index, sort=False) -> Index: '\n \n ' other = cast('DatetimeTimedeltaMixin', other) if self._can_range_setop(other): return self._range_intersect(other, sort=sort) if (not self._can_fast_intersect(other)): result = Index._intersection(self, ot...
def _get_join_freq(self, other): '\n Get the freq to attach to the result of a join operation.\n ' freq = None if self._can_fast_union(other): freq = self.freq return freq
-8,029,963,893,525,508,000
Get the freq to attach to the result of a join operation.
pandas/core/indexes/datetimelike.py
_get_join_freq
DiligentDolphin/pandas
python
def _get_join_freq(self, other): '\n \n ' freq = None if self._can_fast_union(other): freq = self.freq return freq
def _get_delete_freq(self, loc: ((int | slice) | Sequence[int])): '\n Find the `freq` for self.delete(loc).\n ' freq = None if (self.freq is not None): if is_integer(loc): if (loc in (0, (- len(self)), (- 1), (len(self) - 1))): freq = self.freq else:...
-9,139,549,193,207,140,000
Find the `freq` for self.delete(loc).
pandas/core/indexes/datetimelike.py
_get_delete_freq
DiligentDolphin/pandas
python
def _get_delete_freq(self, loc: ((int | slice) | Sequence[int])): '\n \n ' freq = None if (self.freq is not None): if is_integer(loc): if (loc in (0, (- len(self)), (- 1), (len(self) - 1))): freq = self.freq else: if is_list_like(loc): ...
def _get_insert_freq(self, loc: int, item): '\n Find the `freq` for self.insert(loc, item).\n ' value = self._data._validate_scalar(item) item = self._data._box_func(value) freq = None if (self.freq is not None): if self.size: if (item is NaT): pass ...
5,177,903,697,816,854,000
Find the `freq` for self.insert(loc, item).
pandas/core/indexes/datetimelike.py
_get_insert_freq
DiligentDolphin/pandas
python
def _get_insert_freq(self, loc: int, item): '\n \n ' value = self._data._validate_scalar(item) item = self._data._box_func(value) freq = None if (self.freq is not None): if self.size: if (item is NaT): pass elif (((loc == 0) or (loc == (-...
def clear_mysql_db(): '\n Clear MySQL Database\n :return: true\n ' logger.info('Clearing MySQL Database') try: drop_table_content() except Exception as exp: logger.error(('Could not clear MySQL Database: ' + repr(exp))) raise else: logger.info('MySQL Database...
-8,534,009,352,897,233,000
Clear MySQL Database :return: true
Account/app/mod_system/controller.py
clear_mysql_db
TamSzaGot/mydata-sdk
python
def clear_mysql_db(): '\n Clear MySQL Database\n :return: true\n ' logger.info('Clearing MySQL Database') try: drop_table_content() except Exception as exp: logger.error(('Could not clear MySQL Database: ' + repr(exp))) raise else: logger.info('MySQL Database...
def clear_blackbox_db(): '\n Clear black box database\n :return: true\n ' logger.info('Clearing Blackbox Database') try: clear_blackbox_sqlite_db() except Exception as exp: logger.error(('Could not clear Blackbox Database: ' + repr(exp))) raise else: logger.i...
2,870,511,574,239,039,000
Clear black box database :return: true
Account/app/mod_system/controller.py
clear_blackbox_db
TamSzaGot/mydata-sdk
python
def clear_blackbox_db(): '\n Clear black box database\n :return: true\n ' logger.info('Clearing Blackbox Database') try: clear_blackbox_sqlite_db() except Exception as exp: logger.error(('Could not clear Blackbox Database: ' + repr(exp))) raise else: logger.i...
def clear_api_key_db(): '\n Clear API Key database\n :return: true\n ' logger.info('##########') logger.info('Clearing ApiKey Database') try: clear_apikey_sqlite_db() except Exception as exp: logger.error(('Could not clear ApiKey Database: ' + repr(exp))) raise e...
-5,303,551,338,756,569,000
Clear API Key database :return: true
Account/app/mod_system/controller.py
clear_api_key_db
TamSzaGot/mydata-sdk
python
def clear_api_key_db(): '\n Clear API Key database\n :return: true\n ' logger.info('##########') logger.info('Clearing ApiKey Database') try: clear_apikey_sqlite_db() except Exception as exp: logger.error(('Could not clear ApiKey Database: ' + repr(exp))) raise e...
def system_check(): '\n Check system functionality\n :return: dict\n ' logger.info('Checking system functionality') try: status_dict = {'type': 'StatusReport', 'attributes': {'title': 'System running as intended', 'db_row_counts': get_db_statistics()}} except Exception as exp: l...
1,838,993,185,687,893,000
Check system functionality :return: dict
Account/app/mod_system/controller.py
system_check
TamSzaGot/mydata-sdk
python
def system_check(): '\n Check system functionality\n :return: dict\n ' logger.info('Checking system functionality') try: status_dict = {'type': 'StatusReport', 'attributes': {'title': 'System running as intended', 'db_row_counts': get_db_statistics()}} except Exception as exp: l...
def sum_mixed_list(mxd_lst: List[Union[(int, float)]]) -> float: 'sum all float number in list\n\n Args:\n input_list (List[float]): arg\n\n Returns:\n float: result\n ' return sum(mxd_lst)
-5,815,243,350,808,947,000
sum all float number in list Args: input_list (List[float]): arg Returns: float: result
0x00-python_variable_annotations/6-sum_mixed_list.py
sum_mixed_list
JoseAVallejo12/holbertonschool-web_back_end
python
def sum_mixed_list(mxd_lst: List[Union[(int, float)]]) -> float: 'sum all float number in list\n\n Args:\n input_list (List[float]): arg\n\n Returns:\n float: result\n ' return sum(mxd_lst)
def valid_vars(vars): "\n Note: run_program_op.InferShape requires `X`/'Out' not be null.\n But it's common in dy2static, fake varBase is created to handle the\n problem.\n " if vars: return vars return [core.VarBase(value=[1], name='Fake_var', place=framework._current_expected_place())]
-6,657,273,862,314,413,000
Note: run_program_op.InferShape requires `X`/'Out' not be null. But it's common in dy2static, fake varBase is created to handle the problem.
python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py
valid_vars
CheQiXiao/Paddle
python
def valid_vars(vars): "\n Note: run_program_op.InferShape requires `X`/'Out' not be null.\n But it's common in dy2static, fake varBase is created to handle the\n problem.\n " if vars: return vars return [core.VarBase(value=[1], name='Fake_var', place=framework._current_expected_place())]
def tolist(self): '\n Flattens the nested sequences into single list.\n ' return flatten(self.__raw_input)
-7,850,800,606,931,174,000
Flattens the nested sequences into single list.
python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py
tolist
CheQiXiao/Paddle
python
def tolist(self): '\n \n ' return flatten(self.__raw_input)
def restore(self, value_list): '\n Restores the nested sequence from value list.\n ' assert (len(self.tolist()) == len(value_list)) return pack_sequence_as(self.__raw_input, value_list)
1,636,940,109,083,474,400
Restores the nested sequence from value list.
python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py
restore
CheQiXiao/Paddle
python
def restore(self, value_list): '\n \n ' assert (len(self.tolist()) == len(value_list)) return pack_sequence_as(self.__raw_input, value_list)
def _check_non_variable(self, need_check): '\n Raises warning if output of traced function contains non-tensor type values.\n ' if need_check: warning_types = set() for var in self.tolist(): if (not isinstance(var, (framework.Variable, core.VarBase))): w...
4,097,785,078,502,480,000
Raises warning if output of traced function contains non-tensor type values.
python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py
_check_non_variable
CheQiXiao/Paddle
python
def _check_non_variable(self, need_check): '\n \n ' if need_check: warning_types = set() for var in self.tolist(): if (not isinstance(var, (framework.Variable, core.VarBase))): warning_types.add(type(var)) if warning_types: logging_ut...
@LazyInitialized def _infer_program(self): '\n Lazy initialized property of infer_program.\n ' return self._clone_for_test(self._origin_main_program)
1,281,564,852,890,502,100
Lazy initialized property of infer_program.
python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py
_infer_program
CheQiXiao/Paddle
python
@LazyInitialized def _infer_program(self): '\n \n ' return self._clone_for_test(self._origin_main_program)
@LazyInitialized def _train_program(self): '\n Lazy initialized property of train_program.\n ' train_program = self._append_backward_desc(self._origin_main_program) self._set_grad_type(self._params, train_program) return train_program
-2,370,555,548,043,581,400
Lazy initialized property of train_program.
python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py
_train_program
CheQiXiao/Paddle
python
@LazyInitialized def _train_program(self): '\n \n ' train_program = self._append_backward_desc(self._origin_main_program) self._set_grad_type(self._params, train_program) return train_program
def _verify_program(self, main_program): '\n Verify that the program parameter is initialized, prune some unused params,\n and remove redundant op callstack.\n ' self._check_params_all_inited(main_program) self._prune_unused_params(main_program) return main_program
944,476,005,322,594,400
Verify that the program parameter is initialized, prune some unused params, and remove redundant op callstack.
python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py
_verify_program
CheQiXiao/Paddle
python
def _verify_program(self, main_program): '\n Verify that the program parameter is initialized, prune some unused params,\n and remove redundant op callstack.\n ' self._check_params_all_inited(main_program) self._prune_unused_params(main_program) return main_program
def _prune_unused_params(self, program): '\n Prune the parameters not used anywhere in the program.\n The `@declarative` may only decorated a sub function which\n contains some unused parameters created in `__init__`.\n So prune these parameters to avoid unnecessary operations in\n ...
-5,956,918,768,261,268,000
Prune the parameters not used anywhere in the program. The `@declarative` may only decorated a sub function which contains some unused parameters created in `__init__`. So prune these parameters to avoid unnecessary operations in `run_program_op`.
python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py
_prune_unused_params
CheQiXiao/Paddle
python
def _prune_unused_params(self, program): '\n Prune the parameters not used anywhere in the program.\n The `@declarative` may only decorated a sub function which\n contains some unused parameters created in `__init__`.\n So prune these parameters to avoid unnecessary operations in\n ...
def _prepare(self, inputs): '\n Prepare inputs, outputs, attrs.\n ' assert isinstance(inputs, (tuple, list)) flatten_inputs = flatten(inputs) input_vars = [] for (i, value) in enumerate(flatten_inputs): if isinstance(value, np.ndarray): var = core.VarBase(value=valu...
5,576,537,689,546,665,000
Prepare inputs, outputs, attrs.
python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py
_prepare
CheQiXiao/Paddle
python
def _prepare(self, inputs): '\n \n ' assert isinstance(inputs, (tuple, list)) flatten_inputs = flatten(inputs) input_vars = [] for (i, value) in enumerate(flatten_inputs): if isinstance(value, np.ndarray): var = core.VarBase(value=value, name=self._inputs[i].desc.na...
def _restore_out(self, out_vars): '\n Restores same nested outputs by only replacing the Variable with VarBase.\n ' flatten_outputs = self._outputs.tolist() for (i, idx) in enumerate(self._outputs.var_ids): flatten_outputs[idx] = out_vars[i] outs = self._outputs.restore(flatten_out...
-6,028,813,199,620,918,000
Restores same nested outputs by only replacing the Variable with VarBase.
python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py
_restore_out
CheQiXiao/Paddle
python
def _restore_out(self, out_vars): '\n \n ' flatten_outputs = self._outputs.tolist() for (i, idx) in enumerate(self._outputs.var_ids): flatten_outputs[idx] = out_vars[i] outs = self._outputs.restore(flatten_outputs) if ((outs is not None) and (len(outs) == 1)): outs = ou...
def _remove_no_value(self, out_vars): '\n Removes invalid value for various-length return statement\n ' if isinstance(out_vars, core.VarBase): if self._is_no_value(out_vars): return None return out_vars elif isinstance(out_vars, (tuple, list)): if isinstance...
-7,001,538,010,932,496,000
Removes invalid value for various-length return statement
python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py
_remove_no_value
CheQiXiao/Paddle
python
def _remove_no_value(self, out_vars): '\n \n ' if isinstance(out_vars, core.VarBase): if self._is_no_value(out_vars): return None return out_vars elif isinstance(out_vars, (tuple, list)): if isinstance(out_vars, tuple): res = tuple((var for var i...
def _remove_op_call_stack(self, main_program): "\n Remove op's python call stack with redundant low-level error messages related to\n transforamtions to avoid confusing users.\n " assert isinstance(main_program, framework.Program) for block in main_program.blocks: for op in bloc...
2,915,306,587,125,424,000
Remove op's python call stack with redundant low-level error messages related to transforamtions to avoid confusing users.
python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py
_remove_op_call_stack
CheQiXiao/Paddle
python
def _remove_op_call_stack(self, main_program): "\n Remove op's python call stack with redundant low-level error messages related to\n transforamtions to avoid confusing users.\n " assert isinstance(main_program, framework.Program) for block in main_program.blocks: for op in bloc...
def _check_params_all_inited(self, main_program): '\n Check all params from main program are already initialized, see details as follows:\n 1. all parameters in self._params should be type `framework.ParamBase` which are created in dygraph.\n 2. all parameters from transformed program c...
-1,005,667,989,976,922,900
Check all params from main program are already initialized, see details as follows: 1. all parameters in self._params should be type `framework.ParamBase` which are created in dygraph. 2. all parameters from transformed program can be found in self._params. Because they share same data with ParamBase of ...
python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py
_check_params_all_inited
CheQiXiao/Paddle
python
def _check_params_all_inited(self, main_program): '\n Check all params from main program are already initialized, see details as follows:\n 1. all parameters in self._params should be type `framework.ParamBase` which are created in dygraph.\n 2. all parameters from transformed program c...
def __init__(self, eventEngine, gatewayName): 'Constructor' self.eventEngine = eventEngine self.gatewayName = gatewayName
1,672,423,060,279,163,100
Constructor
redtorch/trader/vtGateway.py
__init__
sun0x00/redtorch_python
python
def __init__(self, eventEngine, gatewayName): self.eventEngine = eventEngine self.gatewayName = gatewayName
def onTick(self, tick): '市场行情推送' event1 = Event(type_=EVENT_TICK) event1.dict_['data'] = tick self.eventEngine.put(event1) event2 = Event(type_=(EVENT_TICK + tick.vtSymbol)) event2.dict_['data'] = tick self.eventEngine.put(event2)
3,856,064,092,815,750,700
市场行情推送
redtorch/trader/vtGateway.py
onTick
sun0x00/redtorch_python
python
def onTick(self, tick): event1 = Event(type_=EVENT_TICK) event1.dict_['data'] = tick self.eventEngine.put(event1) event2 = Event(type_=(EVENT_TICK + tick.vtSymbol)) event2.dict_['data'] = tick self.eventEngine.put(event2)
def onTrade(self, trade): '成交信息推送' event1 = Event(type_=EVENT_TRADE) event1.dict_['data'] = trade self.eventEngine.put(event1) event2 = Event(type_=(EVENT_TRADE + trade.vtSymbol)) event2.dict_['data'] = trade self.eventEngine.put(event2)
2,063,537,404,431,998,500
成交信息推送
redtorch/trader/vtGateway.py
onTrade
sun0x00/redtorch_python
python
def onTrade(self, trade): event1 = Event(type_=EVENT_TRADE) event1.dict_['data'] = trade self.eventEngine.put(event1) event2 = Event(type_=(EVENT_TRADE + trade.vtSymbol)) event2.dict_['data'] = trade self.eventEngine.put(event2)
def onOrder(self, order): '订单变化推送' event1 = Event(type_=EVENT_ORDER) event1.dict_['data'] = order self.eventEngine.put(event1) event2 = Event(type_=(EVENT_ORDER + order.vtOrderID)) event2.dict_['data'] = order self.eventEngine.put(event2)
5,707,298,845,992,048,000
订单变化推送
redtorch/trader/vtGateway.py
onOrder
sun0x00/redtorch_python
python
def onOrder(self, order): event1 = Event(type_=EVENT_ORDER) event1.dict_['data'] = order self.eventEngine.put(event1) event2 = Event(type_=(EVENT_ORDER + order.vtOrderID)) event2.dict_['data'] = order self.eventEngine.put(event2)
def onPosition(self, position): '持仓信息推送' event1 = Event(type_=EVENT_POSITION) event1.dict_['data'] = position self.eventEngine.put(event1) event2 = Event(type_=(EVENT_POSITION + position.vtSymbol)) event2.dict_['data'] = position self.eventEngine.put(event2)
7,488,092,332,243,463,000
持仓信息推送
redtorch/trader/vtGateway.py
onPosition
sun0x00/redtorch_python
python
def onPosition(self, position): event1 = Event(type_=EVENT_POSITION) event1.dict_['data'] = position self.eventEngine.put(event1) event2 = Event(type_=(EVENT_POSITION + position.vtSymbol)) event2.dict_['data'] = position self.eventEngine.put(event2)
def onAccount(self, account): '账户信息推送' event1 = Event(type_=EVENT_ACCOUNT) event1.dict_['data'] = account self.eventEngine.put(event1) event2 = Event(type_=(EVENT_ACCOUNT + account.vtAccountID)) event2.dict_['data'] = account self.eventEngine.put(event2)
-2,795,242,707,031,535,600
账户信息推送
redtorch/trader/vtGateway.py
onAccount
sun0x00/redtorch_python
python
def onAccount(self, account): event1 = Event(type_=EVENT_ACCOUNT) event1.dict_['data'] = account self.eventEngine.put(event1) event2 = Event(type_=(EVENT_ACCOUNT + account.vtAccountID)) event2.dict_['data'] = account self.eventEngine.put(event2)
def onError(self, error): '错误信息推送' event1 = Event(type_=EVENT_ERROR) event1.dict_['data'] = error self.eventEngine.put(event1)
4,894,823,628,181,121,000
错误信息推送
redtorch/trader/vtGateway.py
onError
sun0x00/redtorch_python
python
def onError(self, error): event1 = Event(type_=EVENT_ERROR) event1.dict_['data'] = error self.eventEngine.put(event1)
def onLog(self, log): '日志推送' event1 = Event(type_=EVENT_LOG) event1.dict_['data'] = log self.eventEngine.put(event1)
7,426,680,771,114,056,000
日志推送
redtorch/trader/vtGateway.py
onLog
sun0x00/redtorch_python
python
def onLog(self, log): event1 = Event(type_=EVENT_LOG) event1.dict_['data'] = log self.eventEngine.put(event1)
def onContract(self, contract): '合约基础信息推送' event1 = Event(type_=EVENT_CONTRACT) event1.dict_['data'] = contract self.eventEngine.put(event1)
2,881,356,330,586,334,000
合约基础信息推送
redtorch/trader/vtGateway.py
onContract
sun0x00/redtorch_python
python
def onContract(self, contract): event1 = Event(type_=EVENT_CONTRACT) event1.dict_['data'] = contract self.eventEngine.put(event1)
def connect(self): '连接' pass
8,699,725,801,578,168,000
连接
redtorch/trader/vtGateway.py
connect
sun0x00/redtorch_python
python
def connect(self): pass
def subscribe(self, subscribeReq): '订阅行情' pass
-1,651,100,944,133,235,000
订阅行情
redtorch/trader/vtGateway.py
subscribe
sun0x00/redtorch_python
python
def subscribe(self, subscribeReq): pass
def sendOrder(self, orderReq): '发单' pass
-6,865,453,469,559,764,000
发单
redtorch/trader/vtGateway.py
sendOrder
sun0x00/redtorch_python
python
def sendOrder(self, orderReq): pass
def cancelOrder(self, cancelOrderReq): '撤单' pass
5,289,705,947,194,827,000
撤单
redtorch/trader/vtGateway.py
cancelOrder
sun0x00/redtorch_python
python
def cancelOrder(self, cancelOrderReq): pass
def qryAccount(self): '查询账户资金' pass
8,067,137,450,306,017,000
查询账户资金
redtorch/trader/vtGateway.py
qryAccount
sun0x00/redtorch_python
python
def qryAccount(self): pass
def qryPosition(self): '查询持仓' pass
1,786,019,952,844,000,000
查询持仓
redtorch/trader/vtGateway.py
qryPosition
sun0x00/redtorch_python
python
def qryPosition(self): pass
def close(self): '关闭' pass
8,479,221,086,581,067,000
关闭
redtorch/trader/vtGateway.py
close
sun0x00/redtorch_python
python
def close(self): pass
def get(self, request): 'Retrieve the user.' user = request.user serializer = self.serializer_class(user) return Response(serializer.data)
7,155,900,420,248,859,000
Retrieve the user.
dakara_server/users/views.py
get
DakaraProject/dakara-server
python
def get(self, request): user = request.user serializer = self.serializer_class(user) return Response(serializer.data)
def skip_201911_and_older(duthost): ' Skip the current test if the DUT version is 201911 or older.\n ' if (parse_version(duthost.kernel_version) <= parse_version('4.9.0')): pytest.skip('Test not supported for 201911 images or older. Skipping the test')
-6,194,294,265,274,752,000
Skip the current test if the DUT version is 201911 or older.
tests/route/test_static_route.py
skip_201911_and_older
LiuKuan-AF/sonic-mgmt
python
def skip_201911_and_older(duthost): ' \n ' if (parse_version(duthost.kernel_version) <= parse_version('4.9.0')): pytest.skip('Test not supported for 201911 images or older. Skipping the test')
def is_dualtor(tbinfo): 'Check if the testbed is dualtor.' return ('dualtor' in tbinfo['topo']['name'])
2,524,877,780,519,400,400
Check if the testbed is dualtor.
tests/route/test_static_route.py
is_dualtor
LiuKuan-AF/sonic-mgmt
python
def is_dualtor(tbinfo): return ('dualtor' in tbinfo['topo']['name'])