code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def test_backend_parameters_kwargs(self): """ It should pass on kwargs specified as keyword params. """ TracingBackend.kwargs = None msg = mail.EmailMessage() tasks.send_email(email_to_dict(msg), foo='bar') self.assertEqual(TracingBackend.kwargs.get('foo'), 'bar')
It should pass on kwargs specified as keyword params.
test_backend_parameters_kwargs
python
pmclanahan/django-celery-email
tests/tests.py
https://github.com/pmclanahan/django-celery-email/blob/master/tests/tests.py
BSD-3-Clause
def test_backend_parameters(self): """ Our backend should pass kwargs to the 'send_emails' task. """ kwargs = {'auth_user': 'user', 'auth_password': 'pass'} mail.send_mass_mail([ ('test1', 'Testing with Celery! w00t!!', 'from@example.com', ['to@example.com']), ('test2', '...
Our backend should pass kwargs to the 'send_emails' task.
test_backend_parameters
python
pmclanahan/django-celery-email
tests/tests.py
https://github.com/pmclanahan/django-celery-email/blob/master/tests/tests.py
BSD-3-Clause
def test_chunking(self): """ Given 11 messages and a chunk size of 4, the backend should queue 11/4 = 3 jobs (2 jobs with 4 messages and 1 job with 3 messages). """ N = 11 chunksize = 4 with override_settings(CELERY_EMAIL_CHUNK_SIZE=4): mail.send_mass...
Given 11 messages and a chunk size of 4, the backend should queue 11/4 = 3 jobs (2 jobs with 4 messages and 1 job with 3 messages).
test_chunking
python
pmclanahan/django-celery-email
tests/tests.py
https://github.com/pmclanahan/django-celery-email/blob/master/tests/tests.py
BSD-3-Clause
def register_vcs_handler(vcs, method): # decorator """Create decorator to mark a method as the handler of a VCS.""" def decorate(f): """Store f in HANDLERS[vcs][method].""" HANDLERS.setdefault(vcs, {})[method] = f return f return decorate
Create decorator to mark a method as the handler of a VCS.
register_vcs_handler
python
mars-project/mars
versioneer.py
https://github.com/mars-project/mars/blob/master/versioneer.py
Apache-2.0
def render_pep440_branch(pieces): """TAG[[.dev0]+DISTANCE.gHEX[.dirty]] . The ".dev0" means not master branch. Note that .dev0 sorts backwards (a feature branch will appear "older" than the master branch). Exceptions: 1: no tags. 0[.dev0]+untagged.DISTANCE.gHEX[.dirty] """ if pieces["close...
TAG[[.dev0]+DISTANCE.gHEX[.dirty]] . The ".dev0" means not master branch. Note that .dev0 sorts backwards (a feature branch will appear "older" than the master branch). Exceptions: 1: no tags. 0[.dev0]+untagged.DISTANCE.gHEX[.dirty]
render_pep440_branch
python
mars-project/mars
versioneer.py
https://github.com/mars-project/mars/blob/master/versioneer.py
Apache-2.0
def pep440_split_post(ver): """Split pep440 version string at the post-release segment. Returns the release segments before the post-release and the post-release version number (or -1 if no post-release segment is present). """ vc = str.split(ver, ".post") return vc[0], int(vc[1] or 0) if len(v...
Split pep440 version string at the post-release segment. Returns the release segments before the post-release and the post-release version number (or -1 if no post-release segment is present).
pep440_split_post
python
mars-project/mars
versioneer.py
https://github.com/mars-project/mars/blob/master/versioneer.py
Apache-2.0
def render_pep440_pre(pieces): """TAG[.postN.devDISTANCE] -- No -dirty. Exceptions: 1: no tags. 0.post0.devDISTANCE """ if pieces["closest-tag"]: if pieces["distance"]: # update the post release segment tag_version, post_version = pep440_split_post(pieces["closest-ta...
TAG[.postN.devDISTANCE] -- No -dirty. Exceptions: 1: no tags. 0.post0.devDISTANCE
render_pep440_pre
python
mars-project/mars
versioneer.py
https://github.com/mars-project/mars/blob/master/versioneer.py
Apache-2.0
def render_pep440_post_branch(pieces): """TAG[.postDISTANCE[.dev0]+gHEX[.dirty]] . The ".dev0" means not master branch. Exceptions: 1: no tags. 0.postDISTANCE[.dev0]+gHEX[.dirty] """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"] or pieces["dir...
TAG[.postDISTANCE[.dev0]+gHEX[.dirty]] . The ".dev0" means not master branch. Exceptions: 1: no tags. 0.postDISTANCE[.dev0]+gHEX[.dirty]
render_pep440_post_branch
python
mars-project/mars
versioneer.py
https://github.com/mars-project/mars/blob/master/versioneer.py
Apache-2.0
def render_pep440_old(pieces): """TAG[.postDISTANCE[.dev0]] . The ".dev0" means dirty. Exceptions: 1: no tags. 0.postDISTANCE[.dev0] """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"] or pieces["dirty"]: rendered += ".post%d" % piec...
TAG[.postDISTANCE[.dev0]] . The ".dev0" means dirty. Exceptions: 1: no tags. 0.postDISTANCE[.dev0]
render_pep440_old
python
mars-project/mars
versioneer.py
https://github.com/mars-project/mars/blob/master/versioneer.py
Apache-2.0
def get_cmdclass(cmdclass=None): """Get the custom setuptools subclasses used by Versioneer. If the package uses a different cmdclass (e.g. one from numpy), it should be provide as an argument. """ if "versioneer" in sys.modules: del sys.modules["versioneer"] # this fixes the "pytho...
Get the custom setuptools subclasses used by Versioneer. If the package uses a different cmdclass (e.g. one from numpy), it should be provide as an argument.
get_cmdclass
python
mars-project/mars
versioneer.py
https://github.com/mars-project/mars/blob/master/versioneer.py
Apache-2.0
def do_setup(): """Do main VCS-independent setup function for installing Versioneer.""" root = get_root() try: cfg = get_config_from_root(root) except (OSError, configparser.NoSectionError, configparser.NoOptionError) as e: if isinstance(e, (OSError, configparser.NoSectionErr...
Do main VCS-independent setup function for installing Versioneer.
do_setup
python
mars-project/mars
versioneer.py
https://github.com/mars-project/mars/blob/master/versioneer.py
Apache-2.0
def q07(lineitem, supplier, orders, customer, nation): """This version is faster than q07_old. Keeping the old one for reference""" lineitem_filtered = lineitem[ (lineitem["L_SHIPDATE"] >= md.Timestamp("1995-01-01")) & (lineitem["L_SHIPDATE"] < md.Timestamp("1997-01-01")) ] lineitem_filt...
This version is faster than q07_old. Keeping the old one for reference
q07
python
mars-project/mars
benchmarks/tpch/run_queries.py
https://github.com/mars-project/mars/blob/master/benchmarks/tpch/run_queries.py
Apache-2.0
def _normalize(string, prefix="", width=76): r"""Convert a string into a format that is appropriate for .po files. >>> print(normalize('''Say: ... "hello, world!" ... ''', width=None)) "" "Say:\n" " \"hello, world!\"\n" >>> print(normalize('''Say: ... "Lorem ipsum dolor sit amet...
Convert a string into a format that is appropriate for .po files. >>> print(normalize('''Say: ... "hello, world!" ... ''', width=None)) "" "Say:\n" " \"hello, world!\"\n" >>> print(normalize('''Say: ... "Lorem ipsum dolor sit amet, consectetur adipisicing elit, " ... ''', width=...
_normalize
python
mars-project/mars
docs/source/norm_zh.py
https://github.com/mars-project/mars/blob/master/docs/source/norm_zh.py
Apache-2.0
async def init( cls, address: str, session_id: str, new: bool = True, **kwargs ) -> "AbstractSession": """ Init a new session. Parameters ---------- address : str Address. session_id : str Session ID. new : bool New...
Init a new session. Parameters ---------- address : str Address. session_id : str Session ID. new : bool New a session. kwargs Returns ------- session
init
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
async def execute(self, *tileables, **kwargs) -> ExecutionInfo: """ Execute tileables. Parameters ---------- tileables Tileables. kwargs """
Execute tileables. Parameters ---------- tileables Tileables. kwargs
execute
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
async def fetch(self, *tileables, **kwargs) -> list: """ Fetch tileables' data. Parameters ---------- tileables Tileables. Returns ------- data """
Fetch tileables' data. Parameters ---------- tileables Tileables. Returns ------- data
fetch
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
async def fetch_tileable_op_logs( self, tileable_op_key: str, offsets: Union[Dict[str, List[int]], str, int], sizes: Union[Dict[str, List[int]], str, int], ) -> Dict: """ Fetch logs given tileable op key. Parameters ---------- tileable_op_key ...
Fetch logs given tileable op key. Parameters ---------- tileable_op_key : str Tileable op key. offsets Chunk op key to offsets. sizes Chunk op key to sizes. Returns ------- chunk_key_to_logs
fetch_tileable_op_logs
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
async def get_total_n_cpu(self): """ Get number of cluster cpus. Returns ------- number_of_cpu: int """
Get number of cluster cpus. Returns ------- number_of_cpu: int
get_total_n_cpu
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
async def get_cluster_versions(self) -> List[str]: """ Get versions used in current Mars cluster Returns ------- version_list : list List of versions """
Get versions used in current Mars cluster Returns ------- version_list : list List of versions
get_cluster_versions
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
async def get_web_endpoint(self) -> Optional[str]: """ Get web endpoint of current session Returns ------- web_endpoint : str web endpoint """
Get web endpoint of current session Returns ------- web_endpoint : str web endpoint
get_web_endpoint
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
async def create_remote_object( self, session_id: str, name: str, object_cls, *args, **kwargs ): """ Create remote object Parameters ---------- session_id : str Session ID. name : str object_cls args kwargs Returns...
Create remote object Parameters ---------- session_id : str Session ID. name : str object_cls args kwargs Returns ------- actor_ref
create_remote_object
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
async def get_remote_object(self, session_id: str, name: str): """ Get remote object. Parameters ---------- session_id : str Session ID. name : str Returns ------- actor_ref """
Get remote object. Parameters ---------- session_id : str Session ID. name : str Returns ------- actor_ref
get_remote_object
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
async def destroy_remote_object(self, session_id: str, name: str): """ Destroy remote object. Parameters ---------- session_id : str Session ID. name : str """
Destroy remote object. Parameters ---------- session_id : str Session ID. name : str
destroy_remote_object
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
async def create_mutable_tensor( self, shape: tuple, dtype: Union[np.dtype, str], name: str = None, default_value: Union[int, float] = 0, chunk_size: Union[int, Tuple] = None, ): """ Create a mutable tensor. Parameters ---------- ...
Create a mutable tensor. Parameters ---------- shape: tuple Shape of the mutable tensor. dtype: np.dtype or str Data type of the mutable tensor. name: str, optional Name of the mutable tensor, a random name will be used if not speci...
create_mutable_tensor
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
async def get_mutable_tensor(self, name: str): """ Get a mutable tensor by name. Parameters ---------- name: str Name of the mutable tensor to get. Returns ------- MutableTensor """
Get a mutable tensor by name. Parameters ---------- name: str Name of the mutable tensor to get. Returns ------- MutableTensor
get_mutable_tensor
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
def init( cls, address: str, session_id: str, backend: str = "mars", new: bool = True, **kwargs, ) -> "AbstractSession": """ Init a new session. Parameters ---------- address : str Address. session_id : str ...
Init a new session. Parameters ---------- address : str Address. session_id : str Session ID. backend : str Backend. new : bool New a session. kwargs Returns ------- session ...
init
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
def execute( self, tileable, *tileables, show_progress: Union[bool, str] = None, **kwargs ) -> Union[List[TileableType], TileableType, ExecutionInfo]: """ Execute tileables. Parameters ---------- tileable Tileable. tileables Tileables....
Execute tileables. Parameters ---------- tileable Tileable. tileables Tileables. show_progress If show progress. kwargs Returns ------- result
execute
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
def fetch(self, *tileables, **kwargs) -> list: """ Fetch tileables. Parameters ---------- tileables Tileables. kwargs Returns ------- fetched_data : list """
Fetch tileables. Parameters ---------- tileables Tileables. kwargs Returns ------- fetched_data : list
fetch
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
def fetch_infos(self, *tileables, fields, **kwargs) -> list: """ Fetch infos of tileables. Parameters ---------- tileables Tileables. fields List of fields kwargs Returns ------- fetched_infos : list """
Fetch infos of tileables. Parameters ---------- tileables Tileables. fields List of fields kwargs Returns ------- fetched_infos : list
fetch_infos
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
def decref(self, *tileables_keys): """ Decref tileables. Parameters ---------- tileables_keys : list Tileables' keys """
Decref tileables. Parameters ---------- tileables_keys : list Tileables' keys
decref
python
mars-project/mars
mars/session.py
https://github.com/mars-project/mars/blob/master/mars/session.py
Apache-2.0
def merge_chunks(chunk_results: List[Tuple[Tuple[int], Any]]) -> Any: """ Concatenate chunk results according to index. Parameters ---------- chunk_results : list of tuple, {(chunk_idx, chunk_result), ...,} Returns ------- Data """ from sklearn.base import BaseEstimator fr...
Concatenate chunk results according to index. Parameters ---------- chunk_results : list of tuple, {(chunk_idx, chunk_result), ...,} Returns ------- Data
merge_chunks
python
mars-project/mars
mars/utils.py
https://github.com/mars-project/mars/blob/master/mars/utils.py
Apache-2.0
def calc_nsplits(chunk_idx_to_shape: Dict[Tuple[int], Tuple[int]]) -> Tuple[Tuple[int]]: """ Calculate a tiled entity's nsplits. Parameters ---------- chunk_idx_to_shape : Dict type, {chunk_idx: chunk_shape} Returns ------- nsplits """ ndim = len(next(iter(chunk_idx_to_shape)))...
Calculate a tiled entity's nsplits. Parameters ---------- chunk_idx_to_shape : Dict type, {chunk_idx: chunk_shape} Returns ------- nsplits
calc_nsplits
python
mars-project/mars
mars/utils.py
https://github.com/mars-project/mars/blob/master/mars/utils.py
Apache-2.0
def flatten(nested_iterable: Union[List, Tuple]) -> List: """ Flatten a nested iterable into a list. Parameters ---------- nested_iterable : list or tuple an iterable which can contain other iterables Returns ------- flattened : list Examples -------- >>> flatten([...
Flatten a nested iterable into a list. Parameters ---------- nested_iterable : list or tuple an iterable which can contain other iterables Returns ------- flattened : list Examples -------- >>> flatten([[0, 1], [2, 3]]) [0, 1, 2, 3] >>> flatten([[0, 1], [[3], ...
flatten
python
mars-project/mars
mars/utils.py
https://github.com/mars-project/mars/blob/master/mars/utils.py
Apache-2.0
def stack_back(flattened: List, raw: Union[List, Tuple]) -> Union[List, Tuple]: """ Organize a new iterable from a flattened list according to raw iterable. Parameters ---------- flattened : list flattened list raw: list raw iterable Returns ------- ret : list ...
Organize a new iterable from a flattened list according to raw iterable. Parameters ---------- flattened : list flattened list raw: list raw iterable Returns ------- ret : list Examples -------- >>> raw = [[0, 1], [2, [3, 4]]] >>> flattened = flatten(r...
stack_back
python
mars-project/mars
mars/utils.py
https://github.com/mars-project/mars/blob/master/mars/utils.py
Apache-2.0
def adapt_mars_docstring(doc: str) -> str: """ Adapt numpy-style docstrings to Mars docstring. This util function will add Mars imports, replace object references and add execute calls. Note that check is needed after replacement. """ if doc is None: return None lines = [] firs...
Adapt numpy-style docstrings to Mars docstring. This util function will add Mars imports, replace object references and add execute calls. Note that check is needed after replacement.
adapt_mars_docstring
python
mars-project/mars
mars/utils.py
https://github.com/mars-project/mars/blob/master/mars/utils.py
Apache-2.0
def quiet_stdio(): """Quiets standard outputs when inferring types of functions""" with _io_quiet_lock: _io_quiet_local.is_wrapped = True sys.stdout = _QuietIOWrapper(sys.stdout) sys.stderr = _QuietIOWrapper(sys.stderr) try: yield finally: with _io_quiet_lock: ...
Quiets standard outputs when inferring types of functions
quiet_stdio
python
mars-project/mars
mars/utils.py
https://github.com/mars-project/mars/blob/master/mars/utils.py
Apache-2.0
def stringify_path(path: Union[str, os.PathLike]) -> str: """ Convert *path* to a string or unicode path if possible. """ if isinstance(path, str): return path # checking whether path implements the filesystem protocol try: return path.__fspath__() except AttributeError: ...
Convert *path* to a string or unicode path if possible.
stringify_path
python
mars-project/mars
mars/utils.py
https://github.com/mars-project/mars/blob/master/mars/utils.py
Apache-2.0
def register_asyncio_task_timeout_detector( check_interval: int = None, task_timeout_seconds: int = None, task_exclude_filters: List[str] = None, ) -> Optional[asyncio.Task]: # pragma: no cover """Register a asyncio task which print timeout task periodically.""" check_interval = check_interval or i...
Register a asyncio task which print timeout task periodically.
register_asyncio_task_timeout_detector
python
mars-project/mars
mars/utils.py
https://github.com/mars-project/mars/blob/master/mars/utils.py
Apache-2.0
def merge_dict(dest: Dict, src: Dict, path=None, overwrite=True): """ Merges src dict into dest dict. Parameters ---------- dest: Dict dest dict src: Dict source dict path: List merge path overwrite: bool Whether overwrite dest dict when where is a confli...
Merges src dict into dest dict. Parameters ---------- dest: Dict dest dict src: Dict source dict path: List merge path overwrite: bool Whether overwrite dest dict when where is a conflict Returns ------- Dict Updated dest dict
merge_dict
python
mars-project/mars
mars/utils.py
https://github.com/mars-project/mars/blob/master/mars/utils.py
Apache-2.0
def flatten_dict_to_nested_dict(flatten_dict: Dict, sep=".") -> Dict: """ Return nested dict from flatten dict. Parameters ---------- flatten_dict: Dict sep: str flatten key separator Returns ------- Dict Nested dict """ assert all(isinstance(k, str) for k i...
Return nested dict from flatten dict. Parameters ---------- flatten_dict: Dict sep: str flatten key separator Returns ------- Dict Nested dict
flatten_dict_to_nested_dict
python
mars-project/mars
mars/utils.py
https://github.com/mars-project/mars/blob/master/mars/utils.py
Apache-2.0
def is_full_slice(slc: Any) -> bool: """Check if the input is a full slice ((:) or (0:))""" return ( isinstance(slc, slice) and (slc.start == 0 or slc.start is None) and slc.stop is None and slc.step is None )
Check if the input is a full slice ((:) or (0:))
is_full_slice
python
mars-project/mars
mars/utils.py
https://github.com/mars-project/mars/blob/master/mars/utils.py
Apache-2.0
def wrap_exception( exc: Exception, bases: Tuple[Type] = None, wrap_name: str = None, message: str = None, traceback: Optional[TracebackType] = None, attr_dict: dict = None, ): """Generate an exception wraps the cause exception.""" def __init__(self): pass def __getattr__(s...
Generate an exception wraps the cause exception.
wrap_exception
python
mars-project/mars
mars/utils.py
https://github.com/mars-project/mars/blob/master/mars/utils.py
Apache-2.0
def get_node_ip_address(address="8.8.8.8:53"): """Determine the IP address of the local node. Args: address (str): The IP address and port of any known live service on the network you care about. Returns: The IP address of the current node. """ ip_address, port = addres...
Determine the IP address of the local node. Args: address (str): The IP address and port of any known live service on the network you care about. Returns: The IP address of the current node.
get_node_ip_address
python
mars-project/mars
mars/utils.py
https://github.com/mars-project/mars/blob/master/mars/utils.py
Apache-2.0
def convert_dask_collection(dc): """ Convert dask collection object into mars.core.Object via remote API Parameters ---------- dc: dask collection Dask collection object to be converted. Returns ------- Object Mars Object. """ if not is_dask_collection(dc): ...
Convert dask collection object into mars.core.Object via remote API Parameters ---------- dc: dask collection Dask collection object to be converted. Returns ------- Object Mars Object.
convert_dask_collection
python
mars-project/mars
mars/contrib/dask/converter.py
https://github.com/mars-project/mars/blob/master/mars/contrib/dask/converter.py
Apache-2.0
def mars_scheduler(dsk: dict, keys: Union[List[List[str]], List[str]]): """ A Dask-Mars scheduler This scheduler is intended to be compatible with existing dask user interface, no callbacks are implemented. Parameters ---------- dsk: Dict Dask graph, represented as a task DAG dicti...
A Dask-Mars scheduler This scheduler is intended to be compatible with existing dask user interface, no callbacks are implemented. Parameters ---------- dsk: Dict Dask graph, represented as a task DAG dictionary. keys: Union[List[List[str]], List[str]] 1d or 2d list of Das...
mars_scheduler
python
mars-project/mars
mars/contrib/dask/scheduler.py
https://github.com/mars-project/mars/blob/master/mars/contrib/dask/scheduler.py
Apache-2.0
def mars_dask_get(dsk: dict, keys: Union[List[List[str]], List[str]]): """ A Dask-Mars convert function. This function will send the dask graph layers to Mars Remote API, generating mars objects correspond to the provided keys. Parameters ---------- dsk: Dict Dask graph, represented...
A Dask-Mars convert function. This function will send the dask graph layers to Mars Remote API, generating mars objects correspond to the provided keys. Parameters ---------- dsk: Dict Dask graph, represented as a task DAG dictionary. keys: Union[List[List[str]], List[str]] ...
mars_dask_get
python
mars-project/mars
mars/contrib/dask/scheduler.py
https://github.com/mars-project/mars/blob/master/mars/contrib/dask/scheduler.py
Apache-2.0
def concat(objs: List): """ Concat the results of partitioned dask task executions. This function guess the types of resulting list, then calls the corresponding native dask concat functions. Parameters ---------- objs: List List of the partitioned dask task execution results, which...
Concat the results of partitioned dask task executions. This function guess the types of resulting list, then calls the corresponding native dask concat functions. Parameters ---------- objs: List List of the partitioned dask task execution results, which will be concat. Returns ...
concat
python
mars-project/mars
mars/contrib/dask/utils.py
https://github.com/mars-project/mars/blob/master/mars/contrib/dask/utils.py
Apache-2.0
def get_local_host_ip(self) -> str: """ Get local worker's host ip Returns ------- host_ip : str """
Get local worker's host ip Returns ------- host_ip : str
get_local_host_ip
python
mars-project/mars
mars/core/context.py
https://github.com/mars-project/mars/blob/master/mars/core/context.py
Apache-2.0
def get_total_n_cpu(self) -> int: """ Get number of cpus. Returns ------- number_of_cpu: int """
Get number of cpus. Returns ------- number_of_cpu: int
get_total_n_cpu
python
mars-project/mars
mars/core/context.py
https://github.com/mars-project/mars/blob/master/mars/core/context.py
Apache-2.0
def get_slots(self) -> int: """ Get num of slots of current band Returns ------- number_of_bands: int """
Get num of slots of current band Returns ------- number_of_bands: int
get_slots
python
mars-project/mars
mars/core/context.py
https://github.com/mars-project/mars/blob/master/mars/core/context.py
Apache-2.0
def get_chunks_result(self, data_keys: List[str], fetch_only: bool = False) -> List: """ Get result of chunks. Parameters ---------- data_keys : list Data keys. fetch_only : bool If fetch_only, only fetch data but not return. Returns ...
Get result of chunks. Parameters ---------- data_keys : list Data keys. fetch_only : bool If fetch_only, only fetch data but not return. Returns ------- results : list Result of chunks if not fetch_only, else return N...
get_chunks_result
python
mars-project/mars
mars/core/context.py
https://github.com/mars-project/mars/blob/master/mars/core/context.py
Apache-2.0
def get_chunks_meta( self, data_keys: List[str], fields: List[str] = None, error="raise" ) -> List[Dict]: """ Get meta of chunks. Parameters ---------- data_keys : list Data keys. fields : list Fields to filter. error : str ...
Get meta of chunks. Parameters ---------- data_keys : list Data keys. fields : list Fields to filter. error : str raise, ignore Returns ------- meta_list : list Meta list.
get_chunks_meta
python
mars-project/mars
mars/core/context.py
https://github.com/mars-project/mars/blob/master/mars/core/context.py
Apache-2.0
def get_storage_info(self, address: str, level: StorageLevel): """ Get the customized storage backend info of requested storage backend level at given worker. Parameters ---------- address: str The worker address. level: StorageLevel The storage l...
Get the customized storage backend info of requested storage backend level at given worker. Parameters ---------- address: str The worker address. level: StorageLevel The storage level to fetch the backend info. Returns ------- i...
get_storage_info
python
mars-project/mars
mars/core/context.py
https://github.com/mars-project/mars/blob/master/mars/core/context.py
Apache-2.0
def create_remote_object(self, name: str, object_cls, *args, **kwargs): """ Create remote object. Parameters ---------- name : str Object name. object_cls Object class. args kwargs Returns ------- ref ...
Create remote object. Parameters ---------- name : str Object name. object_cls Object class. args kwargs Returns ------- ref
create_remote_object
python
mars-project/mars
mars/core/context.py
https://github.com/mars-project/mars/blob/master/mars/core/context.py
Apache-2.0
def get_remote_object(self, name: str): """ Get remote object Parameters ---------- name : str Object name. Returns ------- ref """
Get remote object Parameters ---------- name : str Object name. Returns ------- ref
get_remote_object
python
mars-project/mars
mars/core/context.py
https://github.com/mars-project/mars/blob/master/mars/core/context.py
Apache-2.0
def destroy_remote_object(self, name: str): """ Destroy remote object. Parameters ---------- name : str Object name. """
Destroy remote object. Parameters ---------- name : str Object name.
destroy_remote_object
python
mars-project/mars
mars/core/context.py
https://github.com/mars-project/mars/blob/master/mars/core/context.py
Apache-2.0
def register_custom_log_path( self, session_id: str, tileable_op_key: str, chunk_op_key: str, worker_address: str, log_path: str, ): """ Register custom log path. Parameters ---------- session_id : str Session ID. ...
Register custom log path. Parameters ---------- session_id : str Session ID. tileable_op_key : str Key of tileable's op. chunk_op_key : str Kye of chunk's op. worker_address : str Worker address. log_path :...
register_custom_log_path
python
mars-project/mars
mars/core/context.py
https://github.com/mars-project/mars/blob/master/mars/core/context.py
Apache-2.0
def new_custom_log_dir(self) -> str: """ New custom log dir. Returns ------- custom_log_dir : str Custom log dir. """
New custom log dir. Returns ------- custom_log_dir : str Custom log dir.
new_custom_log_dir
python
mars-project/mars
mars/core/context.py
https://github.com/mars-project/mars/blob/master/mars/core/context.py
Apache-2.0
def set_running_operand_key(self, session_id: str, op_key: str): """ Set key of running operand. Parameters ---------- session_id : str op_key : str """
Set key of running operand. Parameters ---------- session_id : str op_key : str
set_running_operand_key
python
mars-project/mars
mars/core/context.py
https://github.com/mars-project/mars/blob/master/mars/core/context.py
Apache-2.0
def set_progress(self, progress: float): """ Set progress of running operand. Parameters ---------- progress : float """
Set progress of running operand. Parameters ---------- progress : float
set_progress
python
mars-project/mars
mars/core/context.py
https://github.com/mars-project/mars/blob/master/mars/core/context.py
Apache-2.0
def redirect_custom_log(func: Callable[[Type, Context, OperandType], None]): """ Redirect stdout to a file by wrapping ``Operand.execute(ctx, op)`` """ @functools.wraps(func) def wrap(cls, ctx: Context, op: OperandType): custom_log_dir = ctx.new_custom_log_dir() if custom_log_dir i...
Redirect stdout to a file by wrapping ``Operand.execute(ctx, op)``
redirect_custom_log
python
mars-project/mars
mars/core/custom_log.py
https://github.com/mars-project/mars/blob/master/mars/core/custom_log.py
Apache-2.0
def init_extension_entrypoints(): """Execute all `mars_extensions` entry points with the name `init` If extensions have already been initialized, this function does nothing. """ from pkg_resources import iter_entry_points for entry_point in iter_entry_points("mars_extensions", "init"): logg...
Execute all `mars_extensions` entry points with the name `init` If extensions have already been initialized, this function does nothing.
init_extension_entrypoints
python
mars-project/mars
mars/core/entrypoints.py
https://github.com/mars-project/mars/blob/master/mars/core/entrypoints.py
Apache-2.0
def __getitem__(self, item): """ The indices for `cix` can be [x, y] or [x, :]. For the former the result will be a single chunk, and for the later the result will be a list of chunks (flattened). The length of indices must be the same with `chunk_shape` of tileable. """...
The indices for `cix` can be [x, y] or [x, :]. For the former the result will be a single chunk, and for the later the result will be a list of chunks (flattened). The length of indices must be the same with `chunk_shape` of tileable.
__getitem__
python
mars-project/mars
mars/core/entity/tileables.py
https://github.com/mars-project/mars/blob/master/mars/core/entity/tileables.py
Apache-2.0
def results(self): """ Return result tileables or chunks. Returns ------- results """
Return result tileables or chunks. Returns ------- results
results
python
mars-project/mars
mars/core/graph/entity.py
https://github.com/mars-project/mars/blob/master/mars/core/graph/entity.py
Apache-2.0
def results(self, new_results): """ Set result tileables or chunks. Parameters ---------- new_results Returns ------- """
Set result tileables or chunks. Parameters ---------- new_results Returns -------
results
python
mars-project/mars
mars/core/graph/entity.py
https://github.com/mars-project/mars/blob/master/mars/core/graph/entity.py
Apache-2.0
def build(self) -> Generator[Union[EntityGraph, ChunkGraph], None, None]: """ Build a entity graph. Returns ------- graph : EntityGraph Entity graph. """
Build a entity graph. Returns ------- graph : EntityGraph Entity graph.
build
python
mars-project/mars
mars/core/graph/builder/base.py
https://github.com/mars-project/mars/blob/master/mars/core/graph/builder/base.py
Apache-2.0
def get_logic_key(self): """The subclass may need to override this method to ensure unique and deterministic.""" fields = self._get_logic_key_token_values() try: return tokenize(*fields) except Exception as e: # pragma: no cover raise ValueError( ...
The subclass may need to override this method to ensure unique and deterministic.
get_logic_key
python
mars-project/mars
mars/core/operand/base.py
https://github.com/mars-project/mars/blob/master/mars/core/operand/base.py
Apache-2.0
def new_chunks( self, inputs: List[ChunkType], kws: List[Dict] = None, **kwargs ) -> List[ChunkType]: """ Create chunks. A chunk is a node in a fine grained graph, all the chunk objects are created by calling this function, it happens mostly in tiles. The generated c...
Create chunks. A chunk is a node in a fine grained graph, all the chunk objects are created by calling this function, it happens mostly in tiles. The generated chunks will be set as this operand's outputs and each chunk will hold this operand as it's op. Parameters ...
new_chunks
python
mars-project/mars
mars/core/operand/core.py
https://github.com/mars-project/mars/blob/master/mars/core/operand/core.py
Apache-2.0
def new_tileables( self, inputs: List[TileableType], kws: List[dict] = None, **kw ) -> List[TileableType]: """ Create tileable objects(Tensors or DataFrames). This is a base function for create tileable objects like tensors or dataframes, it will be called inside the `new_te...
Create tileable objects(Tensors or DataFrames). This is a base function for create tileable objects like tensors or dataframes, it will be called inside the `new_tensors` and `new_dataframes`. If eager mode is on, it will trigger the execution after tileable objects are created. ...
new_tileables
python
mars-project/mars
mars/core/operand/core.py
https://github.com/mars-project/mars/blob/master/mars/core/operand/core.py
Apache-2.0
def pre_tile(cls, op: OperandType): """ Operation before tile. Parameters ---------- op : OperandType Operand to tile """
Operation before tile. Parameters ---------- op : OperandType Operand to tile
pre_tile
python
mars-project/mars
mars/core/operand/core.py
https://github.com/mars-project/mars/blob/master/mars/core/operand/core.py
Apache-2.0
def post_tile(cls, op: OperandType, results: List[TileableType]): """ Operation after tile. Parameters ---------- op : OperandType Operand to tile. results: list List of tiled results. """
Operation after tile. Parameters ---------- op : OperandType Operand to tile. results: list List of tiled results.
post_tile
python
mars-project/mars
mars/core/operand/core.py
https://github.com/mars-project/mars/blob/master/mars/core/operand/core.py
Apache-2.0
def pre_execute(cls, ctx: Union[dict, Context], op: OperandType): """ Operation before execute. Parameters ---------- ctx : dict Data store. op : OperandType Operand to execute. """
Operation before execute. Parameters ---------- ctx : dict Data store. op : OperandType Operand to execute.
pre_execute
python
mars-project/mars
mars/core/operand/core.py
https://github.com/mars-project/mars/blob/master/mars/core/operand/core.py
Apache-2.0
def post_execute(cls, ctx: Union[dict, Context], op: OperandType): """ Operand before execute. Parameters ---------- ctx : dict Data store op : OperandType Operand to execute. """
Operand before execute. Parameters ---------- ctx : dict Data store op : OperandType Operand to execute.
post_execute
python
mars-project/mars
mars/core/operand/core.py
https://github.com/mars-project/mars/blob/master/mars/core/operand/core.py
Apache-2.0
def execute(cls, ctx, op): """ Fetch operand needs nothing to do. """
Fetch operand needs nothing to do.
execute
python
mars-project/mars
mars/core/operand/fetch.py
https://github.com/mars-project/mars/blob/master/mars/core/operand/fetch.py
Apache-2.0
def execute(self, ctx, op): """The mapper stage must ensure all mapper blocks are inserted into ctx and no blocks for some reducers are missing. This is needed by shuffle fetch by index, which shuffle block are identified by the index instead of data keys. For operands implementation si...
The mapper stage must ensure all mapper blocks are inserted into ctx and no blocks for some reducers are missing. This is needed by shuffle fetch by index, which shuffle block are identified by the index instead of data keys. For operands implementation simplicity, we can sort the `ctx` by key ...
execute
python
mars-project/mars
mars/core/operand/shuffle.py
https://github.com/mars-project/mars/blob/master/mars/core/operand/shuffle.py
Apache-2.0
def to_frame(self, index: bool = True, name=None): """ Create a DataFrame with a column containing the Index. Parameters ---------- index : bool, default True Set the index of the returned DataFrame as the original Index. name : object, default None ...
Create a DataFrame with a column containing the Index. Parameters ---------- index : bool, default True Set the index of the returned DataFrame as the original Index. name : object, default None The passed name should substitute for the index name (if i...
to_frame
python
mars-project/mars
mars/dataframe/core.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/core.py
Apache-2.0
def to_series(self, index=None, name=None): """ Create a Series with both index and values equal to the index keys. Useful with map for returning an indexer based on an index. Parameters ---------- index : Index, optional Index of resulting Series. If None, ...
Create a Series with both index and values equal to the index keys. Useful with map for returning an indexer based on an index. Parameters ---------- index : Index, optional Index of resulting Series. If None, defaults to original index. name : str, optiona...
to_series
python
mars-project/mars
mars/dataframe/core.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/core.py
Apache-2.0
def index(self): """ The index (axis labels) of the Series. """ idx = self._data.index idx._set_df_or_series(self, 0) return idx
The index (axis labels) of the Series.
index
python
mars-project/mars
mars/dataframe/core.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/core.py
Apache-2.0
def copy(self, deep=True): # pylint: disable=arguments-differ """ Make a copy of this object's indices and data. When ``deep=True`` (default), a new object will be created with a copy of the calling object's data and indices. Modifications to the data or indices of the copy wil...
Make a copy of this object's indices and data. When ``deep=True`` (default), a new object will be created with a copy of the calling object's data and indices. Modifications to the data or indices of the copy will not be reflected in the original object (see notes below). ...
copy
python
mars-project/mars
mars/dataframe/core.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/core.py
Apache-2.0
def to_frame(self, name=None): """ Convert Series to DataFrame. Parameters ---------- name : object, default None The passed name should substitute for the series name (if it has one). Returns ------- DataFrame DataFra...
Convert Series to DataFrame. Parameters ---------- name : object, default None The passed name should substitute for the series name (if it has one). Returns ------- DataFrame DataFrame representation of Series. Exam...
to_frame
python
mars-project/mars
mars/dataframe/core.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/core.py
Apache-2.0
def between(self, left, right, inclusive="both"): """ Return boolean Series equivalent to left <= series <= right. This function returns a boolean vector containing `True` wherever the corresponding Series element is between the boundary values `left` and `right`. NA values are t...
Return boolean Series equivalent to left <= series <= right. This function returns a boolean vector containing `True` wherever the corresponding Series element is between the boundary values `left` and `right`. NA values are treated as `False`. Parameters ---------- ...
between
python
mars-project/mars
mars/dataframe/core.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/core.py
Apache-2.0
def median( self, axis=None, skipna=True, out=None, overwrite_input=False, keepdims=False ): """ Return the median of the values over the requested axis. Parameters ---------- axis : {index (0)} Axis or axes along which the medians are computed. The defau...
Return the median of the values over the requested axis. Parameters ---------- axis : {index (0)} Axis or axes along which the medians are computed. The default is to compute the median along a flattened version of the tensor. A sequence of axes is s...
median
python
mars-project/mars
mars/dataframe/core.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/core.py
Apache-2.0
def itertuples(self, index=True, name="Pandas", batch_size=1000, session=None): """ Iterate over DataFrame rows as namedtuples. Parameters ---------- index : bool, default True If True, return the index as the first element of the tuple. name : str or None, d...
Iterate over DataFrame rows as namedtuples. Parameters ---------- index : bool, default True If True, return the index as the first element of the tuple. name : str or None, default "Pandas" The name of the returned namedtuples or None to return regular ...
itertuples
python
mars-project/mars
mars/dataframe/core.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/core.py
Apache-2.0
def assign(self, **kwargs): """ Assign new columns to a DataFrame. Returns a new object with all original columns in addition to new ones. Existing columns that are re-assigned will be overwritten. Parameters ---------- **kwargs : dict of {str: callable or Series...
Assign new columns to a DataFrame. Returns a new object with all original columns in addition to new ones. Existing columns that are re-assigned will be overwritten. Parameters ---------- **kwargs : dict of {str: callable or Series} The column names are keyw...
assign
python
mars-project/mars
mars/dataframe/core.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/core.py
Apache-2.0
def decide_dataframe_chunk_sizes(shape, chunk_size, memory_usage): """ Decide how a given DataFrame can be split into chunk. :param shape: DataFrame's shape :param chunk_size: if dict provided, it's dimension id to chunk size; if provided, it's the chunk size for each dimension. ...
Decide how a given DataFrame can be split into chunk. :param shape: DataFrame's shape :param chunk_size: if dict provided, it's dimension id to chunk size; if provided, it's the chunk size for each dimension. :param memory_usage: pandas Series in which each column's memory usage...
decide_dataframe_chunk_sizes
python
mars-project/mars
mars/dataframe/utils.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/utils.py
Apache-2.0
def split_monotonic_index_min_max( left_min_max, left_increase, right_min_max, right_increase ): """ Split the original two min_max into new min_max. Each min_max should be a list in which each item should be a 4-tuple indicates that this chunk's min value, whether the min value is close, the max va...
Split the original two min_max into new min_max. Each min_max should be a list in which each item should be a 4-tuple indicates that this chunk's min value, whether the min value is close, the max value, and whether the max value is close. The return value would be a nested list, each item is a list ...
split_monotonic_index_min_max
python
mars-project/mars
mars/dataframe/utils.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/utils.py
Apache-2.0
def merge_index_value(to_merge_index_values: dict, store_data: bool = False): """ Merge index value according to their chunk index. Parameters ---------- to_merge_index_values : dict index to index_value store_data : bool store data in index_value Returns ------- me...
Merge index value according to their chunk index. Parameters ---------- to_merge_index_values : dict index to index_value store_data : bool store data in index_value Returns ------- merged_index_value
merge_index_value
python
mars-project/mars
mars/dataframe/utils.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/utils.py
Apache-2.0
def in_range_index(i, pd_range_index): """ Check whether the input `i` is within `pd_range_index` which is a pd.RangeIndex. """ start, stop, step = ( _get_range_index_start(pd_range_index), _get_range_index_stop(pd_range_index), _get_range_index_step(pd_range_index), ) if...
Check whether the input `i` is within `pd_range_index` which is a pd.RangeIndex.
in_range_index
python
mars-project/mars
mars/dataframe/utils.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/utils.py
Apache-2.0
def validate_axis_style_args( data, args, kwargs, arg_name, method_name ): # pragma: no cover """Argument handler for mixed index, columns / axis functions In an attempt to handle both `.method(index, columns)`, and `.method(arg, axis=.)`, we have to do some bad things to argument parsing. This tr...
Argument handler for mixed index, columns / axis functions In an attempt to handle both `.method(index, columns)`, and `.method(arg, axis=.)`, we have to do some bad things to argument parsing. This translates all arguments to `{index=., columns=.}` style. Parameters ---------- data : DataFram...
validate_axis_style_args
python
mars-project/mars
mars/dataframe/utils.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/utils.py
Apache-2.0
def fetch_corner_data(df_or_series, session=None) -> pd.DataFrame: """ Fetch corner DataFrame or Series for repr usage. :param df_or_series: DataFrame or Series :return: corner DataFrame """ from .indexing.iloc import iloc max_rows = pd.get_option("display.max_rows") try: min_r...
Fetch corner DataFrame or Series for repr usage. :param df_or_series: DataFrame or Series :return: corner DataFrame
fetch_corner_data
python
mars-project/mars
mars/dataframe/utils.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/utils.py
Apache-2.0
def patch_sa_engine_execute(): """ pandas did not resolve compatibility issue of sqlalchemy 2.0, the issue is https://github.com/pandas-dev/pandas/issues/40686. We need to patch Engine class in SQLAlchemy, and then our code can work well. """ try: from sqlalchemy.engine import Engine ...
pandas did not resolve compatibility issue of sqlalchemy 2.0, the issue is https://github.com/pandas-dev/pandas/issues/40686. We need to patch Engine class in SQLAlchemy, and then our code can work well.
patch_sa_engine_execute
python
mars-project/mars
mars/dataframe/utils.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/utils.py
Apache-2.0
def df_apply( df, func, axis=0, raw=False, result_type=None, args=(), dtypes=None, dtype=None, name=None, output_type=None, index=None, elementwise=None, skip_infer=False, **kwds, ): """ Apply a function along an axis of the DataFrame. Objects passed ...
Apply a function along an axis of the DataFrame. Objects passed to the function are Series objects whose index is either the DataFrame's index (``axis=0``) or the DataFrame's columns (``axis=1``). By default (``result_type=None``), the final return type is inferred from the return type of the appl...
df_apply
python
mars-project/mars
mars/dataframe/base/apply.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/base/apply.py
Apache-2.0
def series_apply( series, func, convert_dtype=True, output_type=None, args=(), dtypes=None, dtype=None, name=None, index=None, skip_infer=False, **kwds, ): """ Invoke function on values of Series. Can be ufunc (a NumPy function that applies to the entire Series) ...
Invoke function on values of Series. Can be ufunc (a NumPy function that applies to the entire Series) or a Python function that only works on single values. Parameters ---------- func : function Python function or NumPy ufunc to apply. convert_dtype : bool, default True ...
series_apply
python
mars-project/mars
mars/dataframe/base/apply.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/base/apply.py
Apache-2.0
def astype(df, dtype, copy=True, errors="raise"): """ Cast a pandas object to a specified dtype ``dtype``. Parameters ---------- dtype : data type, or dict of column name -> data type Use a numpy.dtype or Python type to cast entire pandas object to the same type. Alternatively, use ...
Cast a pandas object to a specified dtype ``dtype``. Parameters ---------- dtype : data type, or dict of column name -> data type Use a numpy.dtype or Python type to cast entire pandas object to the same type. Alternatively, use {col: dtype, ...}, where col is a column label an...
astype
python
mars-project/mars
mars/dataframe/base/astype.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/base/astype.py
Apache-2.0
def filter_by_bloom_filter( df1: TileableType, df2: TileableType, left_on: Union[str, List], right_on: Union[str, List], max_elements: int = 10000, error_rate: float = 0.1, combine_size: int = None, ): """ Use bloom filter to filter DataFrame. Parameters ---------- df1: ...
Use bloom filter to filter DataFrame. Parameters ---------- df1: DataFrame. DataFrame to be filtered. df2: DataFrame. Dataframe to build filter. left_on: str or list. Column(s) selected on df1. right_on: str or list. Column(s) selected on df2. max_elemen...
filter_by_bloom_filter
python
mars-project/mars
mars/dataframe/base/bloom_filter.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/base/bloom_filter.py
Apache-2.0
def cut( x, bins, right: bool = True, labels=None, retbins: bool = False, precision: int = 3, include_lowest: bool = False, duplicates: str = "raise", ordered: bool = True, ): """ Bin values into discrete intervals. Use `cut` when you need to segment and sort data values...
Bin values into discrete intervals. Use `cut` when you need to segment and sort data values into bins. This function is also useful for going from a continuous variable to a categorical variable. For example, `cut` could convert ages to groups of age ranges. Supports binning into an equal number o...
cut
python
mars-project/mars
mars/dataframe/base/cut.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/base/cut.py
Apache-2.0
def df_diff(df, periods=1, axis=0): """ First discrete difference of element. Calculates the difference of a DataFrame element compared with another element in the DataFrame (default is the element in the same column of the previous row). Parameters ---------- periods : int, default 1 ...
First discrete difference of element. Calculates the difference of a DataFrame element compared with another element in the DataFrame (default is the element in the same column of the previous row). Parameters ---------- periods : int, default 1 Periods to shift for calculating dif...
df_diff
python
mars-project/mars
mars/dataframe/base/diff.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/base/diff.py
Apache-2.0
def df_pop(df, item): """ Return item and drop from frame. Raise KeyError if not found. Parameters ---------- item : str Label of column to be popped. Returns ------- Series Examples -------- >>> import numpy as np >>> import mars.dataframe as md >>> df = m...
Return item and drop from frame. Raise KeyError if not found. Parameters ---------- item : str Label of column to be popped. Returns ------- Series Examples -------- >>> import numpy as np >>> import mars.dataframe as md >>> df = md.DataFrame([('falcon', 'bird...
df_pop
python
mars-project/mars
mars/dataframe/base/drop.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/base/drop.py
Apache-2.0
def series_drop( series, labels=None, axis=0, index=None, columns=None, level=None, inplace=False, errors="raise", ): """ Return Series with specified index labels removed. Remove elements of a Series based on specifying the index labels. When using a multi-index, labels...
Return Series with specified index labels removed. Remove elements of a Series based on specifying the index labels. When using a multi-index, labels on different levels can be removed by specifying the level. Parameters ---------- labels : single label or list-like Index labels t...
series_drop
python
mars-project/mars
mars/dataframe/base/drop.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/base/drop.py
Apache-2.0
def series_drop_duplicates(series, keep="first", inplace=False, method="auto"): """ Return Series with duplicate values removed. Parameters ---------- keep : {'first', 'last', ``False``}, default 'first' Method to handle dropping duplicates: - 'first' : Drop duplicates except for t...
Return Series with duplicate values removed. Parameters ---------- keep : {'first', 'last', ``False``}, default 'first' Method to handle dropping duplicates: - 'first' : Drop duplicates except for the first occurrence. - 'last' : Drop duplicates except for the last occurrence....
series_drop_duplicates
python
mars-project/mars
mars/dataframe/base/drop_duplicates.py
https://github.com/mars-project/mars/blob/master/mars/dataframe/base/drop_duplicates.py
Apache-2.0