code: def _export_edge_dataframe(graph):
      """Export edges with attributes to pandas.DataFrame
  
      If you want to use source and target vertex IDs as index, you can do:
  
      >>> from string import ascii_letters
      >>> graph = Graph.GRG(25, 0.4)
      >>> graph.vs["name"] = ascii_letters[:graph.vcount()]
      >>> df = graph.get_edge_dataframe()
      >>> df.set_index(['source', 'target'], inplace=True)
  
      The index will be a pandas.MultiIndex. You can use the C{drop=False}
      option to keep the C{source} and C{target} columns.
  
      If you want to use vertex names in the source and target columns:
  
      >>> df = graph.get_edge_dataframe()
      >>> df_vert = graph.get_vertex_dataframe()
      >>> df['source'].replace(df_vert['name'], inplace=True)
      >>> df['target'].replace(df_vert['name'], inplace=True)
      >>> df_vert.set_index('name', inplace=True)  # Optional
  
      @return: a pandas.DataFrame representing edges and their attributes.
        The index uses edge IDs, from 0 to M - 1 where M is the number of
        edges. The first two columns of the dataframe represent the IDs of
        source and target vertices for each edge. These columns have names
        "source" and "target". If your edges have attributes with the same
        names, they will be present in the dataframe, but not in the first
        two columns.
      """
      try:
          import pandas as pd
      except ImportError:
          raise ImportError(
              "You should install pandas in order to use this function"
          ) from None
  
      df = pd.DataFrame(
          {attr: graph.es[attr] for attr in graph.edge_attributes()},
          index=list(range(graph.ecount())),
      )
      df.index.name = "edge ID"
  
      df.insert(
          0,
          "source",
          [e.source for e in graph.es],
          allow_duplicates=True,
      )
      df.insert(
          1,
          "target",
          [e.target for e in graph.es],
          allow_duplicates=True,
      )
  
      return df
  
file_path: python-igraph/src/igraph/io/objects.py
imports: from typing import Union, Sequence
  from collections import defaultdict
  from itertools import repeat
  from warnings import warn
  from igraph.datatypes import UniqueIdGenerator
label_desc: Use image node_id 11 for calling a global function with example usage: _export_edge_dataframe(graph) and returns: df