nodes
stringlengths
501
22.4k
edges
stringlengths
138
5.07k
code
stringlengths
108
19.3k
0, module; 1, function_definition; 2, function_name:to_json; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""Returns the equivalence classes a sorted list of sorted lists."""; 10, assignment; 11, call; 12, identifier:sets; 13, call; 14, i...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 10, 12; 10, 13; 11, 14; 11, 15; 13, 16; 13, 17; 15, 18; 15, 19; 16, 20; 16, 21; 18, 22; 18, 23; 19, 24; 19, 25; 23, 26
def to_json(self): """Returns the equivalence classes a sorted list of sorted lists.""" sets = self.sets() return sorted(sorted(x) for x in sets)
0, module; 1, function_definition; 2, function_name:reload; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, comment:# if len(self.origCols) == 1 and self.origCols[0].type in (int, float, currency):; 9, comment:# self.numericBinning(); 10, comment:# ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 11, 16; 13, 17; 13, 18; 13, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 18, 25; 18, 26; 19, 27; 21, 28; 21, 29; 23, 30; 23, 31; 27, 32; 32, 33; 32, 34; 33, 35; 33, 36; 34, 37; 34, 38; 37, 39; 37, 40
def reload(self): 'Generate histrow for each row and then reverse-sort by length.' self.rows = [] # if len(self.origCols) == 1 and self.origCols[0].type in (int, float, currency): # self.numericBinning() # else: self.discreteBinning() # automatically add cache ...
0, module; 1, function_definition; 2, function_name:resolve_colors; 3, parameters; 4, block; 5, identifier:self; 6, identifier:colorstack; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, string; 12, assignment; 13, identifier:coloropt; 14, identifier:colorstack; 15, block; ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 9, 14; 9, 15; 10, 16; 11, 17; 12, 18; 12, 19; 15, 20; 15, 21; 19, 22; 19, 23; 20, 24; 21, 25; 24, 26; 24, 27; 25, 28; 25, 29; 27, 30; 27, 31; 29, 32; 29, 33; 30, 34; 30, 35; 31, 36; 32, 37; 32, 38; 33, 39
def resolve_colors(self, colorstack): 'Returns the curses attribute for the colorstack, a list of color option names sorted highest-precedence color first.' attr = CursesAttr() for coloropt in colorstack: c = self.get_color(coloropt) attr = attr.update_attr(c) ret...
0, module; 1, function_definition; 2, function_name:get_mentions; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, identifier:docs; 13, None; 14, identifier:sort; 15, False; 16, comment:...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 7, 15; 8, 16; 9, 17; 10, 18; 10, 19; 10, 20; 11, 21; 17, 22; 17, 23; 19, 24; 19, 25; 19, 26; 20, 27; 24, 28; 26, 29; 26, 30; 26, 31; 27, 32; 28, 33; 28, 34; 30, 35; 30, 36; 31, 37; 31, 38; 31, 39; 32, 40; 32, 41; 32, 42; 34, 43; 34...
def get_mentions(self, docs=None, sort=False): """Return a list of lists of the mentions associated with this extractor. Each list of the return will contain the Mentions for one of the mention classes associated with the MentionExtractor. :param docs: If provided, return Mentions from...
0, module; 1, function_definition; 2, function_name:get_candidates; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:docs; 14, None; 15, identifier:spli...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 10, 20; 11, 21; 11, 22; 11, 23; 12, 24; 20, 25; 20, 26; 22, 27; 22, 28; 22, 29; 23, 30; 27, 31; 29, 32; 29, 33; 29, 34; 30, 35; 31, 36; 31, 37; 33, 38; 33, 39; 34, 40; 34, 41; 34, 42; 35, 43; 35, ...
def get_candidates(self, docs=None, split=0, sort=False): """Return a list of lists of the candidates associated with this extractor. Each list of the return will contain the candidates for one of the candidate classes associated with the CandidateExtractor. :param docs: If provided, r...
0, module; 1, function_definition; 2, function_name:add; 3, parameters; 4, block; 5, identifier:self; 6, identifier:text; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, expression_statement; 15, exp...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 10, 22; 11, 23; 12, 24; 13, 25; 13, 26; 14, 27; 15, 28; 16, 29; 22, 30; 22, 31; 23, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 27, 39; 27, 40; 28, 41; 28, 42; 31, 43; 31, 44...
def add(self, text, checked=False, sort=None): """Add a new item to the list. Args: text (str): The text. checked (bool): Whether this item is checked. sort (int): Item id for sorting. """ node = ListItem(parent_id=self.id, parent_server_id=self.serve...
0, module; 1, function_definition; 2, function_name:items_sort; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:items; 7, expression_statement; 8, class_definition; 9, function_definition; 10, return_statement; 11, comment:"""Sort list items, taking into account parent items. Args: items ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 9, 16; 9, 17; 10, 18; 13, 19; 14, 20; 14, 21; 14, 22; 14, 23; 14, 24; 14, 25; 14, 26; 14, 27; 16, 28; 17, 29; 17, 30; 18, 31; 18, 32; 20, 33; 21, 34; 21, 35; 21, 36; 22, 37; 22, 38; 22, 39; 23, 40; 23, 41; 23, 42; 24, 43; 24...
def items_sort(cls, items): """Sort list items, taking into account parent items. Args: items (list[gkeepapi.node.ListItem]): Items to sort. Returns: list[gkeepapi.node.ListItem]: Sorted items. """ class t(tuple): """Tuple with element-based s...
0, module; 1, function_definition; 2, function_name:add; 3, parameters; 4, block; 5, identifier:self; 6, identifier:text; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:checked; 15, False; 16...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 10, 19; 10, 20; 11, 21; 12, 22; 13, 23; 19, 24; 19, 25; 20, 26; 21, 27; 21, 28; 22, 29; 22, 30; 24, 31; 24, 32; 26, 33; 28, 34; 28, 35; 29, 36; 29, 37; 30, 38; 33, 39; 33, 40; 34, 41; 34, 42; 35, 43; 35,...
def add(self, text, checked=False, sort=None): """Add a new sub item to the list. This item must already be attached to a list. Args: text (str): The text. checked (bool): Whether this item is checked. sort (int): Item id for sorting. """ if self.pare...
0, module; 1, function_definition; 2, function_name:get_subsections; 3, parameters; 4, block; 5, identifier:srcdir; 6, identifier:examples_dir; 7, identifier:sortkey; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14,...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 8, 14; 9, 15; 10, 16; 11, 17; 12, 18; 13, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 19, 29; 21, 30; 21, 31; 21, 32; 23, 33; 23, 34; 25, 35; 25, 36; 27, 37; 27, 38; 28, 39; 28, 40; 29, 41; 29, 42; 31, 43; ...
def get_subsections(srcdir, examples_dir, sortkey): """Return the list of subsections of a gallery Parameters ---------- srcdir : str absolute path to directory containing conf.py examples_dir : str path to the examples directory relative to conf.py sortkey : callable Th...
0, module; 1, function_definition; 2, function_name:alphabetical_sort; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, generic_type; 8, expression_statement; 9, return_statement; 10, identifier:list_to_sort; 11, type; 12, identifier:List; 13, type_parameter; 14, comment:"""Sorts a list of strings alphabeticall...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 6, 10; 6, 11; 7, 12; 7, 13; 8, 14; 9, 15; 11, 16; 13, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 19, 23; 19, 24; 21, 25; 24, 26; 24, 27; 25, 28
def alphabetical_sort(list_to_sort: Iterable[str]) -> List[str]: """Sorts a list of strings alphabetically. For example: ['a1', 'A11', 'A2', 'a22', 'a3'] To sort a list in place, don't call this method, which makes a copy. Instead, do this: my_list.sort(key=norm_fold) :param list_to_sort: the li...
0, module; 1, function_definition; 2, function_name:natural_sort; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, generic_type; 8, expression_statement; 9, return_statement; 10, identifier:list_to_sort; 11, type; 12, identifier:List; 13, type_parameter; 14, comment:""" Sorts a list of strings case insensit...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 6, 10; 6, 11; 7, 12; 7, 13; 8, 14; 9, 15; 11, 16; 13, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 19, 23; 19, 24; 21, 25; 24, 26; 24, 27; 25, 28
def natural_sort(list_to_sort: Iterable[str]) -> List[str]: """ Sorts a list of strings case insensitively as well as numerically. For example: ['a1', 'A2', 'a3', 'A11', 'a22'] To sort a list in place, don't call this method, which makes a copy. Instead, do this: my_list.sort(key=natural_keys) ...
0, module; 1, function_definition; 2, function_name:find; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, dictionary_splat_pattern; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_stat...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 6, 23; 7, 24; 8, 25; 9, 26; 9, 27; 10, 28; 11, 29; 12, 30; 13, 31; 14, 32; 15, 33; 15, 34; 16, 35; 17, 36; 18, 37; 19, 38; 19, 39; 20, 40; 21, 41; 21, 42; 22, 43; 26, 44; 27, ...
def find(self, *_clauses, **kwargs): """Perform a simple search on the table. Simply pass keyword arguments as ``filter``. :: results = table.find(country='France') results = table.find(country='France', year=1980) Using ``_limit``:: # just return ...
0, module; 1, function_definition; 2, function_name:find_write_contribs; 3, parameters; 4, type; 5, block; 6, None; 7, expression_statement; 8, expression_statement; 9, comment:# type: Dict[str, List[str]]; 10, for_statement; 11, expression_statement; 12, comment:# type: Dict[str, List[str]]; 13, for_statement; 14, com...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 4, 6; 5, 7; 5, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 5, 17; 5, 18; 5, 19; 7, 20; 8, 21; 10, 22; 10, 23; 10, 24; 11, 25; 13, 26; 13, 27; 13, 28; 15, 29; 16, 30; 18, 31; 19, 32; 21, 33; 21, 34; 23, 35; 23, 36; 24, 37; 24, 38; 24, 39; 24, 40; 24, 41; 25, 42; 25, 43; 26, 44...
def find_write_contribs() -> None: """Look for files, find authors, sort, write file.""" map_file_auth = {} # type: Dict[str, List[str]] for filename in scantree('cltk'): filepath = filename.path # type: str authors_list = get_authors(filepath) # type: List[str] if authors_list: ...
0, module; 1, function_definition; 2, function_name:find_files; 3, parameters; 4, block; 5, identifier:folder; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, return_statement; 12, comment:"""Discover stereo photos and return them as a pairwise ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 9, 15; 9, 16; 9, 17; 10, 18; 11, 19; 13, 20; 13, 21; 14, 22; 14, 23; 16, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 21, 30; 21, 31; 21, 32; 22, 33; 22, 34; 25, 35; 26, 36; 27, 37; 29, 38; 29, 39; 31, 40; 31, 41; 32, 42; 35, 43; 35...
def find_files(folder): """Discover stereo photos and return them as a pairwise sorted list.""" files = [i for i in os.listdir(folder) if i.startswith("left")] files.sort() for i in range(len(files)): insert_string = "right{}".format(files[i * 2][4:]) files.insert(i * 2 + 1, insert_strin...
0, module; 1, function_definition; 2, function_name:cdx_load; 3, parameters; 4, block; 5, identifier:sources; 6, identifier:query; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, comment:# page count is a special case, no further processing; 11, if_statement; 12, expression_statement; 13, if...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 7, 18; 7, 19; 8, 20; 9, 21; 11, 22; 11, 23; 12, 24; 13, 25; 13, 26; 14, 27; 15, 28; 15, 29; 15, 30; 16, 31; 16, 32; 16, 33; 17, 34; 21, 35; 21, 36; 22, 37; 22, 38; 23, 39; 24, 40; 24, 41; 25, 42; 25, 43; 26, 44...
def cdx_load(sources, query, process=True): """ merge text CDX lines from sources, return an iterator for filtered and access-checked sequence of CDX objects. :param sources: iterable for text CDX sources. :param process: bool, perform processing sorting/filtering/grouping ops """ cdx_iter ...
0, module; 1, function_definition; 2, function_name:cdx_sort_closest; 3, parameters; 4, block; 5, identifier:closest; 6, identifier:cdx_iter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, for_statement; 14, identifier:l...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 9, 17; 10, 18; 11, 19; 12, 20; 12, 21; 12, 22; 13, 23; 13, 24; 13, 25; 17, 26; 17, 27; 18, 28; 18, 29; 19, 30; 19, 31; 22, 32; 22, 33; 22, 34; 22, 35; 22, 36; 22, 37; 22, 38; 22, 39; 22, 40; 25, 41; 31, 42; 31, 43; 32...
def cdx_sort_closest(closest, cdx_iter, limit=10): """ sort CDXCaptureResult by closest to timestamp. """ closest_cdx = [] closest_keys = [] closest_sec = timestamp_to_sec(closest) for cdx in cdx_iter: sec = timestamp_to_sec(cdx[TIMESTAMP]) key = abs(closest_sec - sec) ...
0, module; 1, function_definition; 2, function_name:iter_prefix; 3, parameters; 4, block; 5, identifier:reader; 6, identifier:key; 7, expression_statement; 8, return_statement; 9, comment:""" Creates an iterator which iterates over lines that start with prefix 'key' in a sorted text file. """; 10, call; 11,...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 10, 11; 10, 12; 11, 13; 11, 14; 12, 15; 12, 16; 15, 17; 15, 18; 16, 19; 16, 20; 17, 21; 18, 22; 18, 23; 20, 24; 20, 25; 22, 26; 22, 27; 23, 28
def iter_prefix(reader, key): """ Creates an iterator which iterates over lines that start with prefix 'key' in a sorted text file. """ return itertools.takewhile( lambda line: line.startswith(key), search(reader, key))
0, module; 1, function_definition; 2, function_name:sort_basis_dict; 3, parameters; 4, block; 5, identifier:bs; 6, expression_statement; 7, comment:# yapf: disable; 8, expression_statement; 9, comment:# yapf: enable; 10, comment:# Add integers for the elements (being optimistic that element 150 will be found someday); ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 8, 17; 11, 18; 12, 19; 13, 20; 13, 21; 13, 22; 14, 23; 14, 24; 14, 25; 14, 26; 14, 27; 15, 28; 17, 29; 17, 30; 18, 31; 18, 32; 19, 33; 19, 34; 21, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 27, 41; 30, 42; 30, 43; 30...
def sort_basis_dict(bs): """Sorts a basis set dictionary into a standard order This, for example, allows the written file to be more easily read by humans by, for example, putting the name and description before more detailed fields. This is generally for cosmetic reasons. However, users will generall...
0, module; 1, function_definition; 2, function_name:sort_shell; 3, parameters; 4, block; 5, identifier:shell; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, comment:# Transpose of coefficients; 10, expression_statement; 11, comment:# For each primitive, find the index of the first nonzero coefficien...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 6, 30; 6, 31; 7, 32; 8, 33; 8, 34; 10, 35; 12, 36; 14, 37; 16, 38; 18, 39; 20, 40; 21, 41; 23, 42; 24, 43; 25, 44; 26, 45; 27,...
def sort_shell(shell, use_copy=True): """ Sort a basis set shell into a standard order If use_copy is True, the input shells are not modified. """ if use_copy: shell = copy.deepcopy(shell) # Transpose of coefficients tmp_c = list(map(list, zip(*shell['coefficients']))) # For ...
0, module; 1, function_definition; 2, function_name:sort_shells; 3, parameters; 4, block; 5, identifier:shells; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, comment:# Sort primitives within a shell; 10, comment:# (copying already handled above); 11, expression_statement; 12, comment:# Sort the lis...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 6, 15; 7, 16; 8, 17; 8, 18; 11, 19; 13, 20; 18, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 23, 27; 23, 28; 25, 29; 26, 30; 26, 31; 27, 32; 27, 33; 28, 34; 28, 35; 29, 36; 29, 37; 31, 38; 31, 39; 33, 40; 33, 41; 37, 42; 37, 43; 38,...
def sort_shells(shells, use_copy=True): """ Sort a list of basis set shells into a standard order The order within a shell is by decreasing value of the exponent. The order of the shell list is in increasing angular momentum, and then by decreasing number of primitives, then decreasing value of th...
0, module; 1, function_definition; 2, function_name:sort_potentials; 3, parameters; 4, block; 5, identifier:potentials; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, comment:# Sort by increasing AM, then move the last element to the front; 10, expression_statement; 11, expression_statement; 12, ret...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 8, 16; 8, 17; 10, 18; 11, 19; 12, 20; 17, 21; 18, 22; 18, 23; 19, 24; 19, 25; 21, 26; 23, 27; 23, 28; 24, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 28, 35; 32, 36; 32, 37; 34, 38; 34, 39; 35, 40; 35, 41; 36, 42; 36, 43; 38...
def sort_potentials(potentials, use_copy=True): """ Sort a list of ECP potentials into a standard order The order within a potential is not modified. The order of the shell list is in increasing angular momentum, with the largest angular momentum being moved to the front. If use_copy is True,...
0, module; 1, function_definition; 2, function_name:sort_basis; 3, parameters; 4, block; 5, identifier:basis; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, for_statement; 10, return_statement; 11, identifier:use_copy; 12, True; 13, comment:""" Sorts all the information in a basis set into a sta...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 8, 14; 8, 15; 9, 16; 9, 17; 9, 18; 10, 19; 15, 20; 16, 21; 16, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 20, 29; 23, 30; 23, 31; 25, 32; 25, 33; 26, 34; 26, 35; 28, 36; 29, 37; 29, 38; 30, 39; 30, 40; 32, 41; 32, 42; 33, 43; 34,...
def sort_basis(basis, use_copy=True): """ Sorts all the information in a basis set into a standard order If use_copy is True, the input basis set is not modified. """ if use_copy: basis = copy.deepcopy(basis) for k, el in basis['elements'].items(): if 'electron_shells' in el: ...
0, module; 1, function_definition; 2, function_name:sort_single_reference; 3, parameters; 4, block; 5, identifier:ref_entry; 6, expression_statement; 7, comment:# yapf: disable; 8, expression_statement; 9, comment:# yapf: enable; 10, expression_statement; 11, if_statement; 12, comment:"""Sorts a dictionary containing d...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 8, 13; 10, 14; 11, 15; 11, 16; 11, 17; 13, 18; 13, 19; 14, 20; 14, 21; 16, 22; 17, 23; 19, 24; 19, 25; 19, 26; 19, 27; 19, 28; 19, 29; 19, 30; 19, 31; 19, 32; 19, 33; 19, 34; 19, 35; 19, 36; 19, 37; 19, 38; 19, 39; 19, 40; 19, 41; 19, 42; 19, 43...
def sort_single_reference(ref_entry): """Sorts a dictionary containing data for a single reference into a standard order """ # yapf: disable _keyorder = [ # Schema stuff # This function gets called on the schema 'entry', too 'schema_type', 'schema_version', # Type of th...
0, module; 1, function_definition; 2, function_name:sort_references_dict; 3, parameters; 4, block; 5, identifier:refs; 6, expression_statement; 7, if_statement; 8, comment:# We insert this first, That is ok - it will be overwritten; 9, comment:# with the sorted version later; 10, expression_statement; 11, comment:# Thi...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 7, 16; 7, 17; 10, 18; 12, 19; 12, 20; 12, 21; 13, 22; 16, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 21, 31; 23, 32; 24, 33; 25, 34; 25, 35; 26, 36; 26, 37; 30, 38; 31, 39; 32, 40; 32, 41; 33, 42; 35, 43; 37...
def sort_references_dict(refs): """Sorts a reference dictionary into a standard order The keys of the references are also sorted, and the keys for the data for each reference are put in a more canonical order. """ if _use_odict: refs_sorted = OrderedDict() else: refs_sorted = d...
0, module; 1, function_definition; 2, function_name:make_general; 3, parameters; 4, block; 5, identifier:basis; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, identifier:use_copy; 13, True; 14, comment:""" Makes one large...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 8, 15; 9, 16; 10, 17; 10, 18; 10, 19; 11, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 19, 31; 19, 32; 19, 33; 19, 34; 19, 35; 19, 36; 22, 37; 24, 38; 24, 39; 27, 40; 27, 41; 29, 42; 29, 43; 3...
def make_general(basis, use_copy=True): """ Makes one large general contraction for each angular momentum If use_copy is True, the input basis set is not modified. The output of this function is not pretty. If you want to make it nicer, use sort_basis afterwards. """ zero = '0.00000000' ...
0, module; 1, function_definition; 2, function_name:ComputeApplicationUniquifier; 3, parameters; 4, block; 5, identifier:hash_obj; 6, expression_statement; 7, function_definition; 8, function_definition; 9, function_definition; 10, expression_statement; 11, comment:"""Computes hash of application files. Application ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 7, 13; 7, 14; 8, 15; 8, 16; 8, 17; 9, 18; 9, 19; 9, 20; 10, 21; 13, 22; 13, 23; 13, 24; 14, 25; 14, 26; 14, 27; 14, 28; 14, 29; 14, 30; 14, 31; 16, 32; 17, 33; 17, 34; 17, 35; 19, 36; 19, 37; 20, 38; 20, 39; 20, 40; 20, 41; 20, 42; 21, 43; 21, 4...
def ComputeApplicationUniquifier(hash_obj): """Computes hash of application files. Application files can be anywhere on the disk. The application is free to import a Python module from an arbitrary path ok the disk. It is also impossible to distinguish application files from third party libraries. Third part...
0, module; 1, function_definition; 2, function_name:_set_player; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, comment:""" Sort the current player...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 7, 14; 8, 15; 8, 16; 8, 17; 8, 18; 8, 19; 9, 20; 9, 21; 9, 22; 10, 23; 11, 24; 12, 25; 14, 26; 14, 27; 15, 28; 15, 29; 16, 30; 16, 31; 19, 32; 19, 33; 21, 34; 22, 35; 23, 36; 23, 37; 24, 38; 24, 39; 25, 40; 25, 41; 30, 42; 30, 43; 32, 44;...
def _set_player(self): """ Sort the current players into priority order and set self._player Players are ordered by working state then prefernce supplied by user and finally by instance if a player has more than one running. """ players = [] for name, p in self._m...
0, module; 1, function_definition; 2, function_name:file_sort; 3, parameters; 4, block; 5, identifier:my_list; 6, expression_statement; 7, function_definition; 8, expression_statement; 9, return_statement; 10, comment:""" Sort a list of files in a nice way. eg item-10 will be after item-9 """; 11, function_...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 7, 12; 7, 13; 8, 14; 9, 15; 12, 16; 13, 17; 13, 18; 14, 19; 14, 20; 17, 21; 18, 22; 19, 23; 19, 24; 20, 25; 22, 26; 22, 27; 25, 28; 25, 29; 26, 30; 26, 31; 26, 32; 27, 33; 27, 34; 30, 35; 30, 36; 31, 37; 31, 38; 34, 39; 34, 40; 36, 41; 37, 42; 37, 43; ...
def file_sort(my_list): """ Sort a list of files in a nice way. eg item-10 will be after item-9 """ def alphanum_key(key): """ Split the key into str/int parts """ return [int(s) if s.isdigit() else s for s in re.split("([0-9]+)", key)] my_list.sort(key=alphanum...
0, module; 1, function_definition; 2, function_name:squad; 3, parameters; 4, block; 5, identifier:R_in; 6, identifier:t_in; 7, identifier:t_out; 8, expression_statement; 9, if_statement; 10, comment:# This list contains an index for each `t_out` such that; 11, comment:# t_in[i-1] <= t_out < t_in[i]; 12, comment:# Note ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 4, 35; 4, 36; 4, 37; 4, 38; 4, 39; 4, 40; 4, 41; 4, 42; 4, 43; 4, 44; 4, 45; 4, 46; 4, 47; ...
def squad(R_in, t_in, t_out): """Spherical "quadrangular" interpolation of rotors with a cubic spline This is the best way to interpolate rotations. It uses the analog of a cubic spline, except that the interpolant is confined to the rotor manifold in a natural way. Alternative methods involving ...
0, module; 1, function_definition; 2, function_name:get_resource_id; 3, parameters; 4, block; 5, identifier:prefix; 6, list_splat_pattern; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, identifier:data; 12, comment:"""Returns a unique ID based on the SHA256 hash of the pro...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 13, 18; 13, 19; 16, 20; 17, 21; 17, 22; 19, 23; 19, 24; 20, 25; 20, 26; 21, 27; 21, 28; 22, 29; 22, 30; 24, 31; 25, 32; 25, 33; 26, 34; 27, 35; 30, 36; 30, 37; 32, 38; 32, 39; 33, 40; 33, 41; 33, 42; 34, 43; 3...
def get_resource_id(prefix, *data): """Returns a unique ID based on the SHA256 hash of the provided data. The input data is flattened and sorted to ensure identical hashes are generated regardless of the order of the input. Values must be of types `str`, `int` or `float`, any other input type will raise a `...
0, module; 1, function_definition; 2, function_name:sorted; 3, parameters; 4, block; 5, identifier:self; 6, identifier:iterator; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, global_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, while_statement; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 7, 19; 7, 20; 8, 21; 8, 22; 9, 23; 10, 24; 10, 25; 11, 26; 12, 27; 13, 28; 14, 29; 14, 30; 14, 31; 15, 32; 16, 33; 16, 34; 17, 35; 17, 36; 18, 37; 26, 38; 26, 39; 27, 40; 27, 41; 28, 42; 28, 43; 31, 44; ...
def sorted(self, iterator, key=None, reverse=False): """ Sort the elements in iterator, do external sort when the memory goes above the limit. """ global MemoryBytesSpilled, DiskBytesSpilled batch, limit = 100, self._next_limit() chunks, current_chunk = [], [] ...
0, module; 1, function_definition; 2, function_name:_merge_sorted_items; 3, parameters; 4, block; 5, identifier:self; 6, identifier:index; 7, expression_statement; 8, function_definition; 9, expression_statement; 10, if_statement; 11, return_statement; 12, comment:""" load a partition from disk, then sort and group by ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 8, 14; 8, 15; 9, 16; 10, 17; 10, 18; 10, 19; 10, 20; 11, 21; 14, 22; 15, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 17, 29; 19, 30; 20, 31; 20, 32; 20, 33; 21, 34; 21, 35; 23, 36; 24, 37; 25, 38; 25, 39; 27, 40; 27, 41; 30, 42; 33, 43; 3...
def _merge_sorted_items(self, index): """ load a partition from disk, then sort and group by key """ def load_partition(j): path = self._get_spill_dir(j) p = os.path.join(path, str(index)) with open(p, 'rb', 65536) as f: for v in self.serializer.load_s...
0, module; 1, function_definition; 2, function_name:map; 3, parameters; 4, block; 5, identifier:self; 6, identifier:f; 7, default_parameter; 8, expression_statement; 9, function_definition; 10, return_statement; 11, identifier:preservesPartitioning; 12, False; 13, comment:""" Return a new RDD by applying a func...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 15, 18; 15, 19; 16, 20; 17, 21; 17, 22; 20, 23; 21, 24; 21, 25; 22, 26; 22, 27; 23, 28; 23, 29; 29, 30; 29, 31; 30, 32; 30, 33; 33, 34
def map(self, f, preservesPartitioning=False): """ Return a new RDD by applying a function to each element of this RDD. >>> rdd = sc.parallelize(["b", "a", "c"]) >>> sorted(rdd.map(lambda x: (x, 1)).collect()) [('a', 1), ('b', 1), ('c', 1)] """ def func(_, iterat...
0, module; 1, function_definition; 2, function_name:flatMap; 3, parameters; 4, block; 5, identifier:self; 6, identifier:f; 7, default_parameter; 8, expression_statement; 9, function_definition; 10, return_statement; 11, identifier:preservesPartitioning; 12, False; 13, comment:""" Return a new RDD by first apply...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 15, 18; 15, 19; 16, 20; 17, 21; 17, 22; 20, 23; 21, 24; 21, 25; 22, 26; 22, 27; 23, 28; 23, 29; 28, 30; 28, 31; 29, 32; 32, 33; 32, 34; 34, 35; 34, 36; 35, 37; 35, 38; 38, 39
def flatMap(self, f, preservesPartitioning=False): """ Return a new RDD by first applying a function to all elements of this RDD, and then flattening the results. >>> rdd = sc.parallelize([2, 3, 4]) >>> sorted(rdd.flatMap(lambda x: range(1, x)).collect()) [1, 1, 1, 2, 2,...
0, module; 1, function_definition; 2, function_name:distinct; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, return_statement; 9, identifier:numPartitions; 10, None; 11, comment:""" Return a new RDD containing the distinct elements in this RDD. >>> sorted...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 6, 10; 7, 11; 8, 12; 12, 13; 12, 14; 13, 15; 13, 16; 13, 17; 14, 18; 15, 19; 15, 20; 18, 21; 18, 22; 19, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 22, 29; 22, 30; 23, 31; 23, 32; 26, 33; 26, 34; 31, 35; 31, 36; 32, 37; 33, 38; 33, 39; 37, 40; 37, 41; 40, 42; 41, 4...
def distinct(self, numPartitions=None): """ Return a new RDD containing the distinct elements in this RDD. >>> sorted(sc.parallelize([1, 1, 2, 3]).distinct().collect()) [1, 2, 3] """ return self.map(lambda x: (x, None)) \ .reduceByKey(lambda x, _: x, n...
0, module; 1, function_definition; 2, function_name:repartitionAndSortWithinPartitions; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14,...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 9, 23; 10, 24; 11, 25; 11, 26; 12, 27; 13, 28; 14, 29; 14, 30; 14, 31; 15, 32; 23, 33; 23, 34; 25, 35; 25, 36; 26, 37; 27, 38; 27, 39; 28, 40; 28, 41; 30, 42; 31, 43; 31, 44; ...
def repartitionAndSortWithinPartitions(self, numPartitions=None, partitionFunc=portable_hash, ascending=True, keyfunc=lambda x: x): """ Repartition the RDD according to the given partitioner and, within each resulting partition, sort records by their ke...
0, module; 1, function_definition; 2, function_name:sortBy; 3, parameters; 4, block; 5, identifier:self; 6, identifier:keyfunc; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, return_statement; 11, identifier:ascending; 12, True; 13, identifier:numPartitions; 14, None; 15, comment:""" S...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 8, 14; 9, 15; 10, 16; 16, 17; 16, 18; 17, 19; 17, 20; 19, 21; 19, 22; 21, 23; 21, 24; 22, 25; 22, 26; 23, 27; 23, 28; 27, 29; 27, 30; 28, 31
def sortBy(self, keyfunc, ascending=True, numPartitions=None): """ Sorts this RDD by the given keyfunc >>> tmp = [('a', 1), ('b', 2), ('1', 3), ('d', 4), ('2', 5)] >>> sc.parallelize(tmp).sortBy(lambda x: x[0]).collect() [('1', 3), ('2', 5), ('a', 1), ('b', 2), ('d', 4)] ...
0, module; 1, function_definition; 2, function_name:groupBy; 3, parameters; 4, block; 5, identifier:self; 6, identifier:f; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, return_statement; 11, identifier:numPartitions; 12, None; 13, identifier:partitionFunc; 14, identifier:portable_hash; 15, co...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 8, 14; 9, 15; 10, 16; 16, 17; 16, 18; 17, 19; 17, 20; 18, 21; 18, 22; 19, 23; 19, 24; 23, 25; 23, 26; 24, 27; 27, 28; 27, 29; 28, 30; 29, 31; 29, 32; 31, 33; 31, 34; 34, 35
def groupBy(self, f, numPartitions=None, partitionFunc=portable_hash): """ Return an RDD of grouped items. >>> rdd = sc.parallelize([1, 1, 2, 3, 5, 8]) >>> result = rdd.groupBy(lambda x: x % 2).collect() >>> sorted([(x, sorted(y)) for (x, y) in result]) [(0, [2, 8]), (1,...
0, module; 1, function_definition; 2, function_name:top; 3, parameters; 4, block; 5, identifier:self; 6, identifier:num; 7, default_parameter; 8, expression_statement; 9, function_definition; 10, function_definition; 11, return_statement; 12, identifier:key; 13, None; 14, comment:""" Get the top N elements from...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 7, 13; 8, 14; 9, 15; 9, 16; 9, 17; 10, 18; 10, 19; 10, 20; 11, 21; 16, 22; 17, 23; 19, 24; 19, 25; 20, 26; 21, 27; 21, 28; 23, 29; 26, 30; 27, 31; 27, 32; 28, 33; 29, 34; 30, 35; 30, 36; 31, 37; 31, 38; 34, 39; 34, 40; 35, 41; 35, 42; 36, 43; 36...
def top(self, num, key=None): """ Get the top N elements from an RDD. .. note:: This method should only be used if the resulting array is expected to be small, as all the data is loaded into the driver's memory. .. note:: It returns the list sorted in descending order. ...
0, module; 1, function_definition; 2, function_name:saveAsTextFile; 3, parameters; 4, block; 5, identifier:self; 6, identifier:path; 7, default_parameter; 8, expression_statement; 9, function_definition; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, identifier:compressionCodecClass; 14, None...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 7, 14; 8, 15; 9, 16; 9, 17; 9, 18; 10, 19; 11, 20; 12, 21; 12, 22; 12, 23; 17, 24; 17, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 22, 31; 22, 32; 23, 33; 26, 34; 26, 35; 26, 36; 28, 37; 28, 38; 29, 39; 29, 40; 31, 41; 32, 42; 33, 43; 36,...
def saveAsTextFile(self, path, compressionCodecClass=None): """ Save this RDD as a text file, using string representations of elements. @param path: path to text file @param compressionCodecClass: (None by default) string i.e. "org.apache.hadoop.io.compress.GzipCodec" ...
0, module; 1, function_definition; 2, function_name:reduceByKey; 3, parameters; 4, block; 5, identifier:self; 6, identifier:func; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, return_statement; 11, identifier:numPartitions; 12, None; 13, identifier:partitionFunc; 14, identifier:portable_hash;...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 8, 14; 9, 15; 10, 16; 16, 17; 16, 18; 17, 19; 17, 20; 18, 21; 18, 22; 18, 23; 18, 24; 18, 25; 21, 26; 21, 27; 26, 28
def reduceByKey(self, func, numPartitions=None, partitionFunc=portable_hash): """ Merge the values for each key using an associative and commutative reduce function. This will also perform the merging locally on each mapper before sending results to a reducer, similarly to a "combiner" ...
0, module; 1, function_definition; 2, function_name:reduceByKeyLocally; 3, parameters; 4, block; 5, identifier:self; 6, identifier:func; 7, expression_statement; 8, expression_statement; 9, function_definition; 10, function_definition; 11, return_statement; 12, comment:""" Merge the values for each key using an...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 10, 18; 10, 19; 11, 20; 13, 21; 13, 22; 15, 23; 16, 24; 16, 25; 16, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 22, 33; 22, 34; 24, 35; 25, 36; 25, 37; 25, 38; 26, 39; 29, 40; 29, 41; 29, 42; 30, 43; 3...
def reduceByKeyLocally(self, func): """ Merge the values for each key using an associative and commutative reduce function, but return the results immediately to the master as a dictionary. This will also perform the merging locally on each mapper before sending results to a red...
0, module; 1, function_definition; 2, function_name:combineByKey; 3, parameters; 4, block; 5, identifier:self; 6, identifier:createCombiner; 7, identifier:mergeValue; 8, identifier:mergeCombiners; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, expr...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 12, 26; 12, 27; 13, 28; 14, 29; 15, 30; 16, 31; 16, 32; 16, 33; 17, 34; 18, 35; 19, 36; 19, 37; 19, 38; 20, 39; 26, 40; 26, 41; 27, 42; 28, 43; 28, 44;...
def combineByKey(self, createCombiner, mergeValue, mergeCombiners, numPartitions=None, partitionFunc=portable_hash): """ Generic function to combine the elements for each key using a custom set of aggregation functions. Turns an RDD[(K, V)] into a result of type RDD...
0, module; 1, function_definition; 2, function_name:groupByKey; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, function_definition; 10, function_definition; 11, function_definition; 12, expression_statement; 13, expression_statement; 14, expression_s...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 9, 25; 9, 26; 9, 27; 10, 28; 10, 29; 10, 30; 11, 31; 11, 32; 11, 33; 12, 34; 13, 35; 14, 36; 15, 37; 15, 38; 15, 39; 16, 40; 17, 41; 18, 42; 18, 43; 18, 44; 19, ...
def groupByKey(self, numPartitions=None, partitionFunc=portable_hash): """ Group the values for each key in the RDD into a single sequence. Hash-partitions the resulting RDD with numPartitions partitions. .. note:: If you are grouping in order to perform an aggregation (such as a ...
0, module; 1, function_definition; 2, function_name:lookup; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:""" Return the list of values in the RDD for key `key`. This operation is done ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 9, 14; 10, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 15, 21; 15, 22; 17, 23; 17, 24; 18, 25; 18, 26; 20, 27; 21, 28; 21, 29; 23, 30; 23, 31; 27, 32; 27, 33; 30, 34; 30, 35; 32, 36; 32, 37; 33, 38; 33, 39; 33, 40; 34, 41; 34, 42; 35, 43;...
def lookup(self, key): """ Return the list of values in the RDD for key `key`. This operation is done efficiently if the RDD has a known partitioner by only searching the partition that the key maps to. >>> l = range(1000) >>> rdd = sc.parallelize(zip(l, l), 10) ...
0, module; 1, function_definition; 2, function_name:describeTopics; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, return_statement; 10, identifier:maxTermsPerTopic; 11, None; 12, comment:"""Return the topics described by weighted terms. WARNING:...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 6, 10; 6, 11; 7, 12; 8, 13; 8, 14; 8, 15; 9, 16; 13, 17; 13, 18; 14, 19; 15, 20; 19, 21; 20, 22; 21, 23; 21, 24; 22, 25; 24, 26; 24, 27; 25, 28; 25, 29; 26, 30; 26, 31; 27, 32; 29, 33; 29, 34; 33, 35; 33, 36; 34, 37; 34, 38
def describeTopics(self, maxTermsPerTopic=None): """Return the topics described by weighted terms. WARNING: If vocabSize and k are large, this can return a large object! :param maxTermsPerTopic: Maximum number of terms to collect for each topic. (default: vocabulary size) ...
0, module; 1, function_definition; 2, function_name:_sort_cols; 3, parameters; 4, block; 5, identifier:self; 6, identifier:cols; 7, identifier:kwargs; 8, expression_statement; 9, if_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, return_statement; 15, comment:""" R...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 8, 15; 9, 16; 9, 17; 10, 18; 10, 19; 11, 20; 12, 21; 13, 22; 13, 23; 13, 24; 13, 25; 14, 26; 16, 27; 17, 28; 18, 29; 18, 30; 19, 31; 20, 32; 20, 33; 21, 34; 21, 35; 22, 36; 22, 37; 23, 38; 24, 39; 24, 40; 25, 41; 26, 42; 26, 43; 28...
def _sort_cols(self, cols, kwargs): """ Return a JVM Seq of Columns that describes the sort order """ if not cols: raise ValueError("should sort by at least one column") if len(cols) == 1 and isinstance(cols[0], list): cols = cols[0] jcols = [_to_java_colu...
0, module; 1, function_definition; 2, function_name:_list_function_infos; 3, parameters; 4, block; 5, identifier:jvm; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:""" Returns a list of function information via JVM. Sorts wrapped expre...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 12, 18; 12, 19; 13, 20; 13, 21; 16, 22; 16, 23; 16, 24; 16, 25; 17, 26; 17, 27; 19, 28; 19, 29; 22, 30; 23, 31; 24, 32; 25, 33; 27, 34; 27, 35; 28, 36; 28, 37; 30, 38; 30, 39; 31, 40; 31, 41; 32, 42; 32, 43; 3...
def _list_function_infos(jvm): """ Returns a list of function information via JVM. Sorts wrapped expression infos by name and returns them. """ jinfos = jvm.org.apache.spark.sql.api.python.PythonSQLUtils.listBuiltinFunctionInfos() infos = [] for jinfo in jinfos: name = jinfo.getName...
0, module; 1, function_definition; 2, function_name:merge; 3, parameters; 4, block; 5, identifier:iterables; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, if_statement; 13, for_statement; 14, expression_statement; 15, while_...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 6, 17; 6, 18; 7, 19; 7, 20; 8, 21; 9, 22; 10, 23; 11, 24; 11, 25; 11, 26; 12, 27; 12, 28; 13, 29; 13, 30; 13, 31; 14, 32; 15, 33; 15, 34; 16, 35; 16, 36; 21, 37; 22, 38; 22, 39; 23, 40; 23, 41; 25, 42; 25, 43; 25, 44;...
def merge(iterables, key=None, reverse=False): '''Merge multiple sorted inputs into a single sorted output. Similar to sorted(itertools.chain(*iterables)) but returns a generator, does not pull the data into memory all at once, and assumes that each of the input streams is already sorted (smallest to l...
0, module; 1, function_definition; 2, function_name:nsmallest; 3, parameters; 4, block; 5, identifier:n; 6, identifier:iterable; 7, default_parameter; 8, expression_statement; 9, comment:# Short-cut for n==1 is to use min(); 10, if_statement; 11, comment:# When n>=size, it's faster to use sorted(); 12, try_statement; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 7, 26; 7, 27; 8, 28; 10, 29; 10, 30; 12, 31; 12, 32; 12, 33; 14, 34; 14, 35; 16, 36; 17, 37; 18, 38; 18, 39; 19, 40; 20, 41; 21, 42; 22, 43; 23, 44; 23, 4...
def nsmallest(n, iterable, key=None): """Find the n smallest elements in a dataset. Equivalent to: sorted(iterable, key=key)[:n] """ # Short-cut for n==1 is to use min() if n == 1: it = iter(iterable) sentinel = object() if key is None: result = min(it, default...
0, module; 1, function_definition; 2, function_name:nlargest; 3, parameters; 4, block; 5, identifier:n; 6, identifier:iterable; 7, default_parameter; 8, expression_statement; 9, comment:# Short-cut for n==1 is to use max(); 10, if_statement; 11, comment:# When n>=size, it's faster to use sorted(); 12, try_statement; 13...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 7, 26; 7, 27; 8, 28; 10, 29; 10, 30; 12, 31; 12, 32; 12, 33; 14, 34; 14, 35; 16, 36; 17, 37; 18, 38; 18, 39; 19, 40; 20, 41; 21, 42; 22, 43; 23, 44; 23, 4...
def nlargest(n, iterable, key=None): """Find the n largest elements in a dataset. Equivalent to: sorted(iterable, key=key, reverse=True)[:n] """ # Short-cut for n==1 is to use max() if n == 1: it = iter(iterable) sentinel = object() if key is None: result = max...
0, module; 1, function_definition; 2, function_name:sortBy; 3, parameters; 4, block; 5, identifier:self; 6, identifier:col; 7, list_splat_pattern; 8, expression_statement; 9, if_statement; 10, if_statement; 11, expression_statement; 12, return_statement; 13, identifier:cols; 14, comment:"""Sorts the output in each buck...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 8, 14; 9, 15; 9, 16; 10, 17; 10, 18; 11, 19; 12, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 19, 28; 19, 29; 22, 30; 22, 31; 23, 32; 23, 33; 24, 34; 25, 35; 26, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 31, 42; 31, 43; 3...
def sortBy(self, col, *cols): """Sorts the output in each bucket by the given columns on the file system. :param col: a name of a column, or a list of names. :param cols: additional names (optional). If `col` is a list it should be empty. >>> (df.write.format('parquet') # doctest: +SK...
0, module; 1, function_definition; 2, function_name:saveAsLibSVMFile; 3, parameters; 4, block; 5, identifier:data; 6, identifier:dir; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:""" Save labeled data in LIBSVM format. :param data: an RDD of LabeledPoint to be ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 11, 13; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 17, 22; 17, 23; 18, 24; 24, 25; 24, 26; 25, 27; 26, 28; 26, 29; 28, 30; 28, 31; 29, 32
def saveAsLibSVMFile(data, dir): """ Save labeled data in LIBSVM format. :param data: an RDD of LabeledPoint to be saved :param dir: directory to save the data >>> from tempfile import NamedTemporaryFile >>> from fileinput import input >>> from pyspark.mllib.reg...
0, module; 1, function_definition; 2, function_name:union; 3, parameters; 4, block; 5, identifier:self; 6, identifier:rdds; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, return_statement; 14, comment:""" Build the un...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 8, 15; 9, 16; 9, 17; 10, 18; 11, 19; 12, 20; 12, 21; 12, 22; 13, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 18, 29; 18, 30; 19, 31; 19, 32; 21, 33; 21, 34; 22, 35; 23, 36; 23, 37; 25, 38; 25, 39; 27, 40; 27, 41; 28, 42; 30, 43; 30...
def union(self, rdds): """ Build the union of a list of RDDs. This supports unions() of RDDs with different serialized formats, although this forces them to be reserialized using the default serializer: >>> path = os.path.join(tempdir, "union-text.txt") >>> with...
0, module; 1, function_definition; 2, function_name:sortlevel; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, return_statement; 11, identifier:level; 12, None; 13, identifier:ascending; 14, True; 15, identifier:sort_remaining; ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 7, 14; 8, 15; 8, 16; 9, 17; 10, 18; 18, 19; 18, 20; 19, 21; 19, 22; 20, 23; 20, 24; 23, 25; 23, 26; 24, 27; 24, 28
def sortlevel(self, level=None, ascending=True, sort_remaining=None): """ For internal compatibility with with the Index API. Sort the Index. This is for compat with MultiIndex Parameters ---------- ascending : boolean, default True False to sort in descendi...
0, module; 1, function_definition; 2, function_name:get_duplicates; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:""" Extract duplicated index elements. .. deprecated:: 0.23.0 Use idx[idx.duplicated()].unique()...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 10, 12; 10, 13; 11, 14; 11, 15; 12, 16; 12, 17; 13, 18; 13, 19; 13, 20; 14, 21; 14, 22; 18, 23; 18, 24; 18, 25; 20, 26; 20, 27; 21, 28; 21, 29; 29, 30; 29, 31; 30, 32; 30, 33
def get_duplicates(self): """ Extract duplicated index elements. .. deprecated:: 0.23.0 Use idx[idx.duplicated()].unique() instead Returns a sorted list of index elements which appear more than once in the index. Returns ------- array-like ...
0, module; 1, function_definition; 2, function_name:union; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, comment:# TODO: is_dtype_union_...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 7, 25; 7, 26; 8, 27; 9, 28; 10, 29; 11, 30; 12, 31; 12, 32; 13, 33; 13, 34; 18, 35; 18, 36; 20, 37; 20, 38; 20, 39; 21, 40; 21, 41; 21, 42; 22, 43; 22, 44; 22, 4...
def union(self, other, sort=None): """ Form the union of two Index objects. Parameters ---------- other : Index or array-like sort : bool or None, default None Whether to sort the resulting Index. * None : Sort the result, except when ...
0, module; 1, function_definition; 2, function_name:difference; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, expression_stateme...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 7, 20; 7, 21; 8, 22; 9, 23; 10, 24; 11, 25; 11, 26; 11, 27; 12, 28; 13, 29; 14, 30; 15, 31; 16, 32; 17, 33; 18, 34; 18, 35; 19, 36; 23, 37; 23, 38; 24, 39; 24, 40; 25, 41; 25, 42; 27, 43; 28, 44; ...
def difference(self, other, sort=None): """ Return a new Index with elements from the index that are not in `other`. This is the set difference of two Index objects. Parameters ---------- other : Index or array-like sort : False or None, default None ...
0, module; 1, function_definition; 2, function_name:symmetric_difference; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, expression_...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 7, 30; 7, 31; 8, 32; 8, 33; 9, 34; 10, 35; 11, 36; 12, 37; 13, 38; 13, 39; 14, 40; 15, 41; 16, 42; 18, 43; 19, 44; 20, 45; 22,...
def symmetric_difference(self, other, result_name=None, sort=None): """ Compute the symmetric difference of two Index objects. Parameters ---------- other : Index or array-like result_name : str sort : False or None, default None Whether to sort the r...
0, module; 1, function_definition; 2, function_name:asof; 3, parameters; 4, block; 5, identifier:self; 6, identifier:label; 7, expression_statement; 8, try_statement; 9, comment:""" Return the label from the index, or, if not present, the previous one. Assuming that the index is sorted, return the pass...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 8, 11; 8, 12; 10, 13; 11, 14; 11, 15; 12, 16; 13, 17; 15, 18; 16, 19; 16, 20; 17, 21; 17, 22; 18, 23; 19, 24; 19, 25; 20, 26; 22, 27; 22, 28; 23, 29; 23, 30; 24, 31; 24, 32; 25, 33; 26, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 32, 40; 32, 41; 33, 42; 39, 4...
def asof(self, label): """ Return the label from the index, or, if not present, the previous one. Assuming that the index is sorted, return the passed index label if it is in the index, or return the previous index label if the passed one is not in the index. Parameters...
0, module; 1, function_definition; 2, function_name:sort_values; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, if_statement; 13, identifier:return_indexer; 14, False; 15, identifi...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 9, 18; 10, 19; 10, 20; 11, 21; 12, 22; 12, 23; 12, 24; 18, 25; 18, 26; 19, 27; 20, 28; 21, 29; 21, 30; 23, 31; 24, 32; 26, 33; 26, 34; 28, 35; 30, 36; 30, 37; 31, 38; 32, 39; 33, 40; 33, 41; 35, 42; 35, 43; 36,...
def sort_values(self, return_indexer=False, ascending=True): """ Return a sorted copy of the index. Return a sorted copy of the index, and optionally return the indices that sorted the index itself. Parameters ---------- return_indexer : bool, default False ...
0, module; 1, function_definition; 2, function_name:argsort; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, identifier:args; 13, identifier:kwargs; 14, comment:""" Retu...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 10, 17; 11, 18; 15, 19; 15, 20; 16, 21; 16, 22; 17, 23; 18, 24; 18, 25; 20, 26; 20, 27; 23, 28; 24, 29; 24, 30; 25, 31; 25, 32; 28, 33; 28, 34; 31, 35; 32, 36; 34, 37; 34, 38; 37, 39; 37, 40; 38, 41
def argsort(self, *args, **kwargs): """ Return the integer indices that would sort the index. Parameters ---------- *args Passed to `numpy.ndarray.argsort`. **kwargs Passed to `numpy.ndarray.argsort`. Returns ------- numpy...
0, module; 1, function_definition; 2, function_name:slice_indexer; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, comment:# return a slice; 13, if_statement; 14, if_statement; 15...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 9, 23; 10, 24; 11, 25; 13, 26; 13, 27; 14, 28; 14, 29; 15, 30; 25, 31; 25, 32; 26, 33; 27, 34; 28, 35; 29, 36; 30, 37; 30, 38; 31, 39; 31, 40; 32, 41; 32, 42; 33, 43; 33, 44; ...
def slice_indexer(self, start=None, end=None, step=None, kind=None): """ For an ordered or unique index, compute the slice indexer for input labels and step. Parameters ---------- start : label, default None If None, defaults to the beginning end : la...
0, module; 1, function_definition; 2, function_name:_set_grouper; 3, parameters; 4, block; 5, identifier:self; 6, identifier:obj; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, comment:# Keep self.grouper value before overriding; 11, if_statement; 12, comment:# the key must be a valid info item; 13...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 7, 19; 7, 20; 8, 21; 9, 22; 9, 23; 11, 24; 11, 25; 13, 26; 13, 27; 13, 28; 15, 29; 15, 30; 15, 31; 16, 32; 17, 33; 18, 34; 22, 35; 22, 36; 23, 37; 24, 38; 24, 39; 25, 40; 26, 41; 26, 42; 27, 43; 27, 44; ...
def _set_grouper(self, obj, sort=False): """ given an object and the specifications, setup the internal grouper for this particular specification Parameters ---------- obj : the subject object sort : bool, default False whether the resulting grouper s...
0, module; 1, function_definition; 2, function_name:_from_derivatives; 3, parameters; 4, block; 5, identifier:xi; 6, identifier:yi; 7, identifier:x; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, import_from_statement; 13, comment:# return the method for compat with sci...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 10, 22; 11, 23; 12, 24; 12, 25; 14, 26; 15, 27; 16, 28; 24, 29; 25, 30; 26, 31; 26, 32; 27, 33; 27, 34; 28, 35; 28, 36; 32, 37; 32, 38; 34, 39; 34, 40; 36, 41; 37, 42; 37, 43; 40, 4...
def _from_derivatives(xi, yi, x, order=None, der=0, extrapolate=False): """ Convenience function for interpolate.BPoly.from_derivatives. Construct a piecewise polynomial in the Bernstein basis, compatible with the specified values and derivatives at breakpoints. Parameters ---------- xi : ...
0, module; 1, function_definition; 2, function_name:recode_for_groupby; 3, parameters; 4, block; 5, identifier:c; 6, identifier:sort; 7, identifier:observed; 8, expression_statement; 9, comment:# we only care about observed values; 10, if_statement; 11, comment:# Already sorted according to c.categories; all is fine; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 8, 20; 10, 21; 10, 22; 12, 23; 12, 24; 14, 25; 18, 26; 19, 27; 22, 28; 22, 29; 22, 30; 22, 31; 22, 32; 22, 33; 22, 34; 22, 35; 22, 36; 22, 37; 24, 38; 25, 39; 25, 40; 26, 41; 26, 42; 27, 43; 27, 4...
def recode_for_groupby(c, sort, observed): """ Code the categories to ensure we can groupby for categoricals. If observed=True, we return a new Categorical with the observed categories only. If sort=False, return a copy of self, coded with categories as returned by .unique(), followed by any c...
0, module; 1, function_definition; 2, function_name:generate_bins_generic; 3, parameters; 4, block; 5, identifier:values; 6, identifier:binner; 7, identifier:closed; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, comment:# check binner fits data; 13, if_statement; 14, ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 8, 23; 9, 24; 10, 25; 11, 26; 11, 27; 13, 28; 13, 29; 14, 30; 14, 31; 15, 32; 16, 33; 18, 34; 21, 35; 21, 36; 21, 37; 22, 38; 24, 39; 24, 40; 25, 41; 25, 42; 26, 43; 26, 44; 2...
def generate_bins_generic(values, binner, closed): """ Generate bin edge offsets and bin labels for one array using another array which has bin edge values. Both arrays must be sorted. Parameters ---------- values : array of values binner : a comparable array of values representing bins int...
0, module; 1, function_definition; 2, function_name:wide_to_long; 3, parameters; 4, block; 5, identifier:df; 6, identifier:stubnames; 7, identifier:i; 8, identifier:j; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, function_definition; 13, function_definition; 14, if_statement; 15, if_statem...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 9, 26; 9, 27; 10, 28; 10, 29; 11, 30; 12, 31; 12, 32; 12, 33; 13, 34; 13, 35; 13, 36; 14, 37; 14, 38; 14, 39; 15, 40; 15, 41; 16, 42; 16, 43; 16, 44; 17, ...
def wide_to_long(df, stubnames, i, j, sep="", suffix=r'\d+'): r""" Wide panel to long format. Less flexible but more user-friendly than melt. With stubnames ['A', 'B'], this function expects to find one or more group of columns with format A-suffix1, A-suffix2,..., B-suffix1, B-suffix2,... You ...
0, module; 1, function_definition; 2, function_name:argsort; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, identifier:args; 12, identifier:kwargs; 13, comment:""" Returns the indices that w...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 10, 15; 10, 16; 10, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 22, 30; 23, 31; 30, 32; 30, 33; 31, 34; 32, 35; 32, 36; 33, 37; 34, 38; 34, 39; 37, 40; 37, 41; 38, 42; 38, 43;...
def argsort(self, *args, **kwargs): """ Returns the indices that would sort the index and its underlying data. Returns ------- argsorted : numpy array See Also -------- numpy.ndarray.argsort """ nv.validate_argsort(args, kwargs) ...
0, module; 1, function_definition; 2, function_name:union; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, if_statement; 12, return_statement; 13, identifier:sort; 14, None; 15, comment:""" Form the u...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 7, 14; 8, 15; 9, 16; 10, 17; 10, 18; 11, 19; 11, 20; 12, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 20, 31; 20, 32; 20, 33; 20, 34; 20, 35; 20, 36; 20, 37; 20, 38; 21, 39; 21, 40; 22, 41; 22, 42; 23, 43; 2...
def union(self, other, sort=None): """ Form the union of two Index objects and sorts if possible Parameters ---------- other : Index or array-like sort : False or None, default None Whether to sort resulting index. ``sort=None`` returns a mononot...
0, module; 1, function_definition; 2, function_name:nlargest; 3, parameters; 4, block; 5, identifier:self; 6, identifier:n; 7, identifier:columns; 8, default_parameter; 9, expression_statement; 10, return_statement; 11, identifier:keep; 12, string; 13, comment:""" Return the first `n` rows ordered by `columns` ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 8, 11; 8, 12; 9, 13; 10, 14; 12, 15; 14, 16; 14, 17; 16, 18; 16, 19; 18, 20; 18, 21; 20, 22; 20, 23; 21, 24; 21, 25; 21, 26; 21, 27; 25, 28; 25, 29; 26, 30; 26, 31; 27, 32; 27, 33
def nlargest(self, n, columns, keep='first'): """ Return the first `n` rows ordered by `columns` in descending order. Return the first `n` rows with the largest values in `columns`, in descending order. The columns that are not specified are returned as well, but not used for or...
0, module; 1, function_definition; 2, function_name:nsmallest; 3, parameters; 4, block; 5, identifier:self; 6, identifier:n; 7, identifier:columns; 8, default_parameter; 9, expression_statement; 10, return_statement; 11, identifier:keep; 12, string; 13, comment:""" Return the first `n` rows ordered by `columns`...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 8, 11; 8, 12; 9, 13; 10, 14; 12, 15; 14, 16; 14, 17; 16, 18; 16, 19; 18, 20; 18, 21; 20, 22; 20, 23; 21, 24; 21, 25; 21, 26; 21, 27; 25, 28; 25, 29; 26, 30; 26, 31; 27, 32; 27, 33
def nsmallest(self, n, columns, keep='first'): """ Return the first `n` rows ordered by `columns` in ascending order. Return the first `n` rows with the smallest values in `columns`, in ascending order. The columns that are not specified are returned as well, but not used for or...
0, module; 1, function_definition; 2, function_name:append; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, import_from_statement; 13, if_statement; 14, return_statement; 15, identifier:ig...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 11, 22; 11, 23; 11, 24; 12, 25; 12, 26; 13, 27; 13, 28; 13, 29; 14, 30; 22, 31; 22, 32; 23, 33; 23, 34; 23, 35; 23, 36; 23, 37; 23, 38; 23, 39; 23, 40; 23, 41; 24, 42; 24, 43; 25, 4...
def append(self, other, ignore_index=False, verify_integrity=False, sort=None): """ Append rows of `other` to the end of caller, returning a new object. Columns in `other` that are not in the caller are added as new columns. Parameters ---------- other : ...
0, module; 1, function_definition; 2, function_name:join; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, comment:# For SparseDataFrame's benefit; 14, return_st...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 4, 13; 4, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 10, 22; 11, 23; 11, 24; 12, 25; 14, 26; 18, 27; 26, 28; 26, 29; 28, 30; 28, 31; 29, 32; 29, 33; 29, 34; 29, 35; 29, 36; 29, 37; 33, 38; 33, 39; 34, 40; 34, 41; 35, 42; 35, 43; 36, 4...
def join(self, other, on=None, how='left', lsuffix='', rsuffix='', sort=False): """ Join columns of another DataFrame. Join columns with `other` DataFrame either on index or on a key column. Efficiently join multiple DataFrame objects by index at once by passing a l...
0, module; 1, function_definition; 2, function_name:_values_for_argsort; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, attribute; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:np; 13, identifier:ndarray; 14, comment:"""Return values for sorti...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 5, 10; 5, 11; 7, 12; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 15, 18; 15, 19; 16, 20; 16, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27; 22, 28; 22, 29; 25, 30; 25, 31; 26, 32; 26, 33; 28, 34; 28, 35; 32, 36; 32, 37
def _values_for_argsort(self) -> np.ndarray: """Return values for sorting. Returns ------- ndarray The transformed values should maintain the ordering between values within the array. See Also -------- ExtensionArray.argsort """ ...
0, module; 1, function_definition; 2, function_name:_get_combined_index; 3, parameters; 4, block; 5, identifier:indexes; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, comment:# TODO: handle index names!; 10, expression_statement; 11, if_statement; 12, if_statement; 13, return_statement; 14, id...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 10, 19; 11, 20; 11, 21; 11, 22; 11, 23; 11, 24; 12, 25; 12, 26; 13, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 22, 33; 22, 34; 23, 35; 23, 36; 24, 37; 26, 38; 29, 39; 29, 40; 30, 41; 30, 42; 32, 43; 33,...
def _get_combined_index(indexes, intersect=False, sort=False): """ Return the union or intersection of indexes. Parameters ---------- indexes : list of Index or list objects When intersect=True, do not accept list of lists. intersect : bool, default False If True, calculate the ...
0, module; 1, function_definition; 2, function_name:_union_indexes; 3, parameters; 4, block; 5, identifier:indexes; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, if_statement; 10, expression_statement; 11, function_definition; 12, if_statement; 13, identifier:sort; 14, True; 15, comment:""" Ret...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 8, 16; 8, 17; 9, 18; 9, 19; 10, 20; 11, 21; 11, 22; 11, 23; 12, 24; 12, 25; 12, 26; 12, 27; 16, 28; 16, 29; 17, 30; 18, 31; 18, 32; 19, 33; 19, 34; 19, 35; 20, 36; 20, 37; 22, 38; 23, 39; 23, 40; 23, 41; 24, 42; 24, 43; 25, ...
def _union_indexes(indexes, sort=True): """ Return the union of indexes. The behavior of sort and names is not consistent. Parameters ---------- indexes : list of Index or list objects sort : bool, default True Whether the result index should come out sorted or not. Returns ...
0, module; 1, function_definition; 2, function_name:_sanitize_and_check; 3, parameters; 4, block; 5, identifier:indexes; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, if_statement; 10, comment:""" Verify the type of indexes and convert lists to Index. Cases: - [list, list, ...]: Re...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 8, 13; 9, 14; 9, 15; 9, 16; 11, 17; 11, 18; 12, 19; 12, 20; 13, 21; 14, 22; 14, 23; 15, 24; 16, 25; 18, 26; 18, 27; 21, 28; 21, 29; 21, 30; 22, 31; 22, 32; 23, 33; 23, 34; 24, 35; 25, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 31, 43; 3...
def _sanitize_and_check(indexes): """ Verify the type of indexes and convert lists to Index. Cases: - [list, list, ...]: Return ([list, list, ...], 'list') - [list, Index, ...]: Return _sanitize_and_check([Index, Index, ...]) Lists are sorted and converted to Index. - [Index, Index, .....
0, module; 1, function_definition; 2, function_name:_from_inferred_categories; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:inferred_categories; 7, identifier:inferred_codes; 8, identifier:dtype; 9, default_parameter; 10, expression_statement; 11, import_from_statement; 12, expression_statement; 13, expres...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 9, 17; 9, 18; 10, 19; 11, 20; 11, 21; 11, 22; 11, 23; 11, 24; 12, 25; 13, 26; 14, 27; 14, 28; 14, 29; 15, 30; 15, 31; 15, 32; 15, 33; 15, 34; 16, 35; 20, 36; 21, 37; 22, 38; 23, 39; 24, 40; 25, 41; 25, 42; 26, 43; 26,...
def _from_inferred_categories(cls, inferred_categories, inferred_codes, dtype, true_values=None): """ Construct a Categorical from inferred values. For inferred categories (`dtype` is None) the categories are sorted. For explicit `dtype`, the `inferred_...
0, module; 1, function_definition; 2, function_name:sort_values; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, if_statement; 14, identifier:inplace; 15, Fal...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 10, 21; 11, 22; 11, 23; 12, 24; 13, 25; 13, 26; 13, 27; 19, 28; 21, 29; 21, 30; 22, 31; 22, 32; 23, 33; 23, 34; 24, 35; 24, 36; 26, 37; 27, 38; 30, 39; 30, 40; 32, 41; 32, 42; 33, 43; 34, 4...
def sort_values(self, inplace=False, ascending=True, na_position='last'): """ Sort the Categorical by category value returning a new Categorical by default. While an ordering is applied to the category values, sorting in this context refers more to organizing and grouping togeth...
0, module; 1, function_definition; 2, function_name:unique; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, comment:# unlike np.unique, unique1d does not sort; 8, expression_statement; 9, expression_statement; 10, comment:# keep nan in codes; 11, expression_statement; 12, comment:# exclude nan ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 8, 17; 9, 18; 11, 19; 13, 20; 14, 21; 14, 22; 15, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 21, 33; 22, 34; 23, 35; 23, 36; 25, 37; 25, 38; 27, 39; 27, 40; 28, 41; 28, 42; 31, 43; 31,...
def unique(self): """ Return the ``Categorical`` which ``categories`` and ``codes`` are unique. Unused categories are NOT returned. - unordered category: values and categories are sorted by appearance order. - ordered category: values are sorted by appearance order, ca...
0, module; 1, function_definition; 2, function_name:concat; 3, parameters; 4, block; 5, identifier:objs; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, default_...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 4, 16; 4, 17; 4, 18; 6, 19; 6, 20; 7, 21; 7, 22; 8, 23; 8, 24; 9, 25; 9, 26; 10, 27; 10, 28; 11, 29; 11, 30; 12, 31; 12, 32; 13, 33; 13, 34; 14, 35; 14, 36; 15, 37; 15, 38; 16, 39; 17, 40; 18, 41; 22, 42; 40, 43; 40, 44; 41,...
def concat(objs, axis=0, join='outer', join_axes=None, ignore_index=False, keys=None, levels=None, names=None, verify_integrity=False, sort=None, copy=True): """ Concatenate pandas objects along a particular axis with optional set logic along the other axes. Can also add a layer o...
0, module; 1, function_definition; 2, function_name:cut; 3, parameters; 4, block; 5, identifier:x; 6, identifier:bins; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, expression_statement; 14, comment:# NOTE: this binning code is...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 7, 21; 7, 22; 8, 23; 8, 24; 9, 25; 9, 26; 10, 27; 10, 28; 11, 29; 11, 30; 12, 31; 12, 32; 13, 33; 16, 34; 17, 35; 18, 36; 18, 37; 18, 38; 18, 39; 19, 40; 20, 41; 32, 42; 34, 43; 34, 44; 35,...
def cut(x, bins, right=True, labels=None, retbins=False, precision=3, include_lowest=False, duplicates='raise'): """ 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 ...
0, module; 1, function_definition; 2, function_name:union_categoricals; 3, parameters; 4, block; 5, identifier:to_union; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, import_from_statement; 10, import_from_statement; 11, if_statement; 12, function_definition; 13, expression_statement; 14, expr...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 9, 25; 9, 26; 9, 27; 9, 28; 9, 29; 10, 30; 10, 31; 11, 32; 11, 33; 12, 34; 12, 35; 12, 36; 13, 37; 14, 38; 15, 39; 15, 40; 16, 41; 17, 42; 17, 43; 17, 44; 17, 45...
def union_categoricals(to_union, sort_categories=False, ignore_order=False): """ Combine list-like of Categorical-like, unioning categories. All categories must have the same dtype. .. versionadded:: 0.19.0 Parameters ---------- to_union : list-like of Categorical, CategoricalIndex, ...
0, module; 1, function_definition; 2, function_name:argsort; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, list_splat_pattern; 9, dictionary_splat_pattern; 10, expression_statement; 11, comment:# Implementor note: You have two places to override the behavior of; 12, comment...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 9, 25; 10, 26; 15, 27; 16, 28; 17, 29; 18, 30; 18, 31; 19, 32; 23, 33; 27, 34; 27, 35; 28, 36; 28, 37; 29, 38; 29, 39; 30, 40; 31, 41; 35, 42; 35, 43; 37, 44; 37...
def argsort(self, ascending=True, kind='quicksort', *args, **kwargs): """ Return the indices that would sort this array. Parameters ---------- ascending : bool, default True Whether the indices should result in an ascending or descending sort. kin...
0, module; 1, function_definition; 2, function_name:factorize; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, typed_default_parameter; 8, generic_type; 9, expression_statement; 10, comment:# Impelmentor note: There are two ways to override the behavior of; 11, comment:# pandas.factorize; 12, comment:# 1. _val...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 4, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 5, 17; 5, 18; 5, 19; 5, 20; 5, 21; 5, 22; 7, 23; 7, 24; 7, 25; 8, 26; 8, 27; 9, 28; 18, 29; 18, 30; 19, 31; 20, 32; 21, 33; 22, 34; 24, 35; 25, 36; 27, 37; 27, 38; 29, 39; 29, 40; 29, 41; 30, 42; 31, 43; 31, 44; 32, 4...
def factorize( self, na_sentinel: int = -1, ) -> Tuple[np.ndarray, ABCExtensionArray]: """ Encode the extension array as an enumerated type. Parameters ---------- na_sentinel : int, default -1 Value to use in the `labels` array to indicate...
0, module; 1, function_definition; 2, function_name:sort_values; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, identifier:return_indexer; 11, False; 12, identifier:ascending; 13, True; 14, comment:""" Return sorted copy of ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 6, 10; 6, 11; 7, 12; 7, 13; 8, 14; 9, 15; 9, 16; 9, 17; 16, 18; 16, 19; 16, 20; 16, 21; 17, 22; 18, 23; 19, 24; 19, 25; 20, 26; 21, 27; 22, 28; 22, 29; 22, 30; 22, 31; 22, 32; 22, 33; 22, 34; 23, 35; 23, 36; 24, 37; 25, 38; 26, 39; 26, 40; 27, 41; 27, 42; 28, 43; 29...
def sort_values(self, return_indexer=False, ascending=True): """ Return sorted copy of Index. """ if return_indexer: _as = self.argsort() if not ascending: _as = _as[::-1] sorted_index = self.take(_as) return sorted_index, _...
0, module; 1, function_definition; 2, function_name:sort_values; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, raise_statement; 14, identifier:by; 15, None; ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 4, 13; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 10, 23; 11, 24; 11, 25; 12, 26; 13, 27; 23, 28; 25, 29; 27, 30; 27, 31; 31, 32; 32, 33; 32, 34
def sort_values(self, by=None, axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last'): """ Sort by the values along either axis. Parameters ----------%(optional_by)s axis : %(axes_single_arg)s, default 0 Axis to be sorted. ...
0, module; 1, function_definition; 2, function_name:groupby; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, dictionary_splat_pattern; 15, ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 8, 25; 9, 26; 9, 27; 10, 28; 10, 29; 11, 30; 11, 31; 12, 32; 12, 33; 13, 34; 13, 35; 14, 36; 15, 37; 16, 38; 16, 39; 17, 40; 17, 41; 18, 42; 19, 43; 38, 44; 38, ...
def groupby(self, by=None, axis=0, level=None, as_index=True, sort=True, group_keys=True, squeeze=False, observed=False, **kwargs): """ Group DataFrame or Series using a mapper or by a Series of columns. A groupby operation involves some combination of splitting the obje...
0, module; 1, function_definition; 2, function_name:sort_values; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, comment:# Validate the axis parameter; 14, ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 6, 30; 6, 31; 7, 32; 7, 33; 8, 34; 8, 35; 9, 36; 9, 37; 10, 38; 10, 39; 11, 40; 12, 41; 14, 42; 16, 43; 16, 44; 17, 45; 17, 46...
def sort_values(self, axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last'): """ Sort by the values. Sort a Series in ascending or descending order by some criterion. Parameters ---------- axis : {0 or 'index'}, default...
0, module; 1, function_definition; 2, function_name:sort_index; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, expression_statement; 14, comment:# TODO: this can...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 6, 27; 6, 28; 7, 29; 7, 30; 8, 31; 8, 32; 9, 33; 9, 34; 10, 35; 10, 36; 11, 37; 11, 38; 12, 39; 12, 40; 13, 41; 16, 42; 18, 43; 19, 44; 20, 45; 20,...
def sort_index(self, axis=0, level=None, ascending=True, inplace=False, kind='quicksort', na_position='last', sort_remaining=True): """ Sort Series by index labels. Returns a new Series sorted by label if `inplace` argument is ``False``, otherwise updates the original...
0, module; 1, function_definition; 2, function_name:nlargest; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:n; 11, integer:5; 12, identifier:keep; 13, string; 14, comment:""" Return the largest `n` elements. ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 6, 10; 6, 11; 7, 12; 7, 13; 8, 14; 9, 15; 13, 16; 15, 17; 15, 18; 17, 19; 17, 20; 19, 21; 19, 22; 21, 23; 21, 24; 22, 25; 22, 26; 22, 27; 26, 28; 26, 29; 27, 30; 27, 31
def nlargest(self, n=5, keep='first'): """ Return the largest `n` elements. Parameters ---------- n : int, default 5 Return this many descending sorted values. keep : {'first', 'last', 'all'}, default 'first' When there are duplicate values that c...
0, module; 1, function_definition; 2, function_name:nsmallest; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:n; 11, integer:5; 12, identifier:keep; 13, string; 14, comment:""" Return the smallest `n` elements...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 6, 10; 6, 11; 7, 12; 7, 13; 8, 14; 9, 15; 13, 16; 15, 17; 15, 18; 17, 19; 17, 20; 19, 21; 19, 22; 21, 23; 21, 24; 22, 25; 22, 26; 22, 27; 26, 28; 26, 29; 27, 30; 27, 31
def nsmallest(self, n=5, keep='first'): """ Return the smallest `n` elements. Parameters ---------- n : int, default 5 Return this many ascending sorted values. keep : {'first', 'last', 'all'}, default 'first' When there are duplicate values that ...
0, module; 1, function_definition; 2, function_name:searchsorted; 3, parameters; 4, block; 5, identifier:self; 6, identifier:value; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, comment:# We are much more performant if the searched; 11, comment:# indexer is the same type as the array.; 12, co...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 7, 19; 7, 20; 8, 21; 8, 22; 9, 23; 17, 24; 17, 25; 18, 26; 24, 27; 25, 28; 25, 29; 26, 30; 26, 31; 27, 32; 29, 33; 30, 34; 30, 35; 31, 36; 31, 37; 31, 38; 32, 39; 32, 40; 34, 41; 34, 42; 37, 43; 37, 44; ...
def searchsorted(self, value, side="left", sorter=None): """ Find indices to insert `value` so as to maintain order. For full documentation, see `numpy.searchsorted` See Also -------- numpy.searchsorted : Equivalent function. """ # We are much more perf...
0, module; 1, function_definition; 2, function_name:from_arrays; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:arrays; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, comment:# Check if elements of array are list-like; 13, for_statement; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 7, 21; 7, 22; 8, 23; 8, 24; 9, 25; 10, 26; 11, 27; 11, 28; 11, 29; 13, 30; 13, 31; 13, 32; 16, 33; 16, 34; 16, 35; 17, 36; 17, 37; 18, 38; 19, 39; 19, 40; 20, 41; 26, 42; 26, 43; 27, 44; 28...
def from_arrays(cls, arrays, sortorder=None, names=None): """ Convert arrays to MultiIndex. Parameters ---------- arrays : list / sequence of array-likes Each array-like gives one level's value for each data point. len(arrays) is the number of levels. ...
0, module; 1, function_definition; 2, function_name:from_tuples; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:tuples; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, return_statement; 13, identifier:sortorder; 14, None; 15, identifier:names; 16, ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 7, 14; 8, 15; 8, 16; 9, 17; 10, 18; 10, 19; 10, 20; 11, 21; 11, 22; 11, 23; 11, 24; 11, 25; 12, 26; 18, 27; 19, 28; 20, 29; 20, 30; 21, 31; 21, 32; 22, 33; 22, 34; 23, 35; 23, 36; 24, 37; 24, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 28...
def from_tuples(cls, tuples, sortorder=None, names=None): """ Convert list of tuples to MultiIndex. Parameters ---------- tuples : list / sequence of tuple-likes Each tuple is the index of one row/column. sortorder : int or None Level of sortednes...
0, module; 1, function_definition; 2, function_name:from_product; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:iterables; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, import_from_statement; 11, import_from_statement; 12, if_statement; 13, expression_statement; 14, expression_sta...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 10, 21; 10, 22; 11, 23; 11, 24; 12, 25; 12, 26; 12, 27; 13, 28; 14, 29; 15, 30; 21, 31; 21, 32; 21, 33; 21, 34; 22, 35; 23, 36; 23, 37; 23, 38; 23, 39; 24, 40; 25, 41; 26, 42; 27, 43; 27, 4...
def from_product(cls, iterables, sortorder=None, names=None): """ Make a MultiIndex from the cartesian product of multiple iterables. Parameters ---------- iterables : list / sequence of iterables Each iterable has unique labels for each level of the index. s...
0, module; 1, function_definition; 2, function_name:from_frame; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:df; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:sortorder; 15, Non...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 10, 19; 10, 20; 11, 21; 12, 22; 13, 23; 19, 24; 20, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 23, 31; 24, 32; 24, 33; 25, 34; 26, 35; 26, 36; 27, 37; 27, 38; 29, 39; 29, 40; 29, 41; 30, 42; 30, 43; 31,...
def from_frame(cls, df, sortorder=None, names=None): """ Make a MultiIndex from a DataFrame. .. versionadded:: 0.24.0 Parameters ---------- df : DataFrame DataFrame to be converted to MultiIndex. sortorder : int, optional Level of sortedn...
0, module; 1, function_definition; 2, function_name:sortlevel; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, import_from_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, comment:# we have a ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 8, 25; 9, 26; 10, 27; 10, 28; 11, 29; 11, 30; 12, 31; 13, 32; 15, 33; 15, 34; 15, 35; 15, 36; 16, 37; 17, 38; 18, 39; 19, 40; 27, 41; 27, 42; 27, 43; 28, 44; 29,...
def sortlevel(self, level=0, ascending=True, sort_remaining=True): """ Sort MultiIndex at the requested level. The result will respect the original ordering of the associated factor at that level. Parameters ---------- level : list-like, int or str, default 0 ...
0, module; 1, function_definition; 2, function_name:slice_locs; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, comment:# This function adds nothing to its parent implementation (the magic; 12, comment:# h...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 13, 23; 23, 24; 23, 25; 24, 26; 24, 27; 25, 28; 25, 29; 25, 30; 25, 31; 26, 32; 26, 33; 31, 34; 31, 35
def slice_locs(self, start=None, end=None, step=None, kind=None): """ For an ordered MultiIndex, compute the slice locations for input labels. The input labels can be tuples representing partial levels, e.g. for a MultiIndex with 3 levels, you can pass a single value (correspond...