src/pybel/struct/summary/supersummary.py
def function_table_df(graph: BELGraph, examples: bool = True) -> pd.DataFrame:
    """Create a dataframe describing the functions in the graph."""
    function_mapping = multidict((node.function, node) for node in graph)
    function_c = Counter({function: len(nodes) for function, nodes in function_mapping.items()})
    if not examples:
        return pd.DataFrame(function_c.most_common(), columns=['Type', 'Count'])
    return pd.DataFrame(
        [
            (function, count, random.choice(function_mapping[function]))  # noqa:S311
            for function, count in function_c.most_common()
        ],
        columns=['Type', 'Count', 'Example'],
    )
Create a dataframe describing the functions in the graph.
Create a dataframe describing the functions in the graph.
Create a dataframe describing the functions in the graph .
def function_table_df(graph: BELGraph, examples: bool = True) -> pd.DataFrame:
    function_mapping = multidict((node.function, node) for node in graph)
    function_c = Counter({function: len(nodes) for function, nodes in function_mapping.items()})
    if not examples:
        return pd.DataFrame(function_c.most_common(), columns=['Type', 'Count'])
    return pd.DataFrame(
        [
            (function, count, random.choice(function_mapping[function]))  
            for function, count in function_c.most_common()
        ],
        columns=['Type', 'Count', 'Example'],
    )
def function_table_df ( graph : BELGraph , examples : bool = True ) -> pd . DataFrame : function_mapping = multidict ( ( node . function , node ) for node in graph ) function_c = Counter ( { function : len ( nodes ) for function , nodes in function_mapping . items ( ) } ) if not examples : return pd . DataFrame ( function_c . most_common ( ) , columns = [ 'Type' , 'Count' ] ) return pd . DataFrame ( [ ( function , count , random . choice ( function_mapping [ function ] ) ) for function , count in function_c . most_common ( ) ] , columns = [ 'Type' , 'Count' , 'Example' ] , )
Create a dataframe describing the functions in the graph.
Create a dataframe describing the functions in the graph .
"""Create a dataframe describing the functions in the graph.""" # noqa:S311
graph
BELGraph
examples
bool