<commit_before>import networkx as nx
import pandas as pd
import logging

logger = logging.getLogger(__name__)


class IndraNet(nx.MultiDiGraph):
    """IndraNet network object

    Methods
    -------

    """
    def __init__(self, incoming_graph_data=None, **attr):
        super().__init__(incoming_graph_data, **attr)
        self._is_multi = True

    @classmethod
    def from_df(cls, df):
        graph = cls()
        mandatory_columns = ['agA_name', 'agB_name', 'agA_ns', 'agA_id',
                             'agB_ns', 'agB_id', 'stmt_type', 'evidence_count',
                             'hash', 'belief']
        """Create an IndraNet MultiDiGraph from a pandas DataFrame

        Parameters
        ----------
        df: pd.DataFrame
            A data frame with each row containing node and edge data for one
            edge. Mandatory columns are {m}. Hashes are used to distinguish
            multiedges between a pair of nodes. Any other columns are
            considered extra node or edge attributes. Any columns starting
            with 'agA_' or 'agB_' (excluding the mandatory agA/B_name) will
            be added to its respective nodes as node attributes. Columns not<commit_msg>Add docstring for class<commit_after>import networkx as nx
import pandas as pd
import logging

logger = logging.getLogger(__name__)


class IndraNet(nx.MultiDiGraph):
    """IndraNet network object

    Methods
    -------
    from_df(df): (classmethod)
        Return an instance of IndraNet, with graph data filled out from a
        dataframe (df) containing pairwise interactions.
    """
    def __init__(self, incoming_graph_data=None, **attr):
        super().__init__(incoming_graph_data, **attr)
        self._is_multi = True

    @classmethod
    def from_df(cls, df):
        graph = cls()
        mandatory_columns = ['agA_name', 'agB_name', 'agA_ns', 'agA_id',
                             'agB_ns', 'agB_id', 'stmt_type', 'evidence_count',
                             'hash', 'belief']
        """Create an IndraNet MultiDiGraph from a pandas DataFrame

        Parameters
        ----------
        df: pd.DataFrame
            A data frame with each row containing node and edge data for one
            edge. Mandatory columns are {m}. Hashes are used to distinguish
            multiedges between a pair of nodes. Any other columns are
            considered extra node or edge attributes. Any columns starting
            with 'agA_' or 'agB_' (excluding the mandatory agA/B_name) will
            be added to its respective nodes as node attributes. Columns not
{'fraction_non_alphanumeric': 0.08908600077130736, 'fraction_numerical': 0.0, 'mean_word_length': 2.2384519350811485, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3418747', 'n_tokens_mistral': 717, 'n_tokens_neox': 698, 'n_words': 253}