src/pybel/struct/summary/supersummary.py
def namespaces_table_df(graph: BELGraph, examples: bool = True) -> pd.DataFrame:
    """Create a dataframe describing the namespaces in the graph."""
    namespace_mapping = multidict((node.namespace, node) for node in graph if isinstance(node, BaseConcept))
    namespace_c = count_namespaces(graph)
    if not examples:
        return pd.DataFrame(namespace_c.most_common(), columns=['Namespace', 'Count'])
    return pd.DataFrame(
        [
            (
                prefix,
                bioregistry.get_name(prefix),
                count,
                random.choice(namespace_mapping[prefix]) if prefix in namespace_mapping else '',  # noqa:S311
            )
            for prefix, count in namespace_c.most_common()
        ],
        columns=['Prefix', 'Name', 'Count', 'Example'],
    )
Create a dataframe describing the namespaces in the graph.
Create a dataframe describing the namespaces in the graph.
Create a dataframe describing the namespaces in the graph .
def namespaces_table_df(graph: BELGraph, examples: bool = True) -> pd.DataFrame:
    namespace_mapping = multidict((node.namespace, node) for node in graph if isinstance(node, BaseConcept))
    namespace_c = count_namespaces(graph)
    if not examples:
        return pd.DataFrame(namespace_c.most_common(), columns=['Namespace', 'Count'])
    return pd.DataFrame(
        [
            (
                prefix,
                bioregistry.get_name(prefix),
                count,
                random.choice(namespace_mapping[prefix]) if prefix in namespace_mapping else '',  
            )
            for prefix, count in namespace_c.most_common()
        ],
        columns=['Prefix', 'Name', 'Count', 'Example'],
    )
def namespaces_table_df ( graph : BELGraph , examples : bool = True ) -> pd . DataFrame : namespace_mapping = multidict ( ( node . namespace , node ) for node in graph if isinstance ( node , BaseConcept ) ) namespace_c = count_namespaces ( graph ) if not examples : return pd . DataFrame ( namespace_c . most_common ( ) , columns = [ 'Namespace' , 'Count' ] ) return pd . DataFrame ( [ ( prefix , bioregistry . get_name ( prefix ) , count , random . choice ( namespace_mapping [ prefix ] ) if prefix in namespace_mapping else '' , ) for prefix , count in namespace_c . most_common ( ) ] , columns = [ 'Prefix' , 'Name' , 'Count' , 'Example' ] , )
Create a dataframe describing the namespaces in the graph.
Create a dataframe describing the namespaces in the graph .
"""Create a dataframe describing the namespaces in the graph.""" # noqa:S311
graph
BELGraph
examples
bool