api/csv_to_graph.py
def read_nodes(csvfile, id_colname):
    """Return a generator which yields the node ids from the given csv file.
    :param str csvfile: Path of the csv file to read node ids from.
    :param str id_colname: Name of the csv column for the ids.
    """
    try:
        f = open(csvfile)
    except IOError:
        logging.error('id file %s not present' % csvfile)
        sys.exit(NO_SUCH_NODE_FILE)

    reader = csv.reader(f)
    headers = reader.next()

    try:
        id_idx = headers.index(id_colname)
    except ValueError:
        logging.error('node id column name not present in %s' % csvfile)
        sys.exit(NO_SUCH_HEADER)

    for row in reader:
        yield row[id_idx]
Return a generator which yields the node ids from the given csv file.
    :param str csvfile: Path of the csv file to read node ids from.
    :param str id_colname: Name of the csv column for the ids.
    
Return a generator which yields the node ids from the given csv file.
Return a generator which yields the node ids from the given csv file .
def read_nodes(csvfile, id_colname):
    try:
        f = open(csvfile)
    except IOError:
        logging.error('id file %s not present' % csvfile)
        sys.exit(NO_SUCH_NODE_FILE)
    reader = csv.reader(f)
    headers = reader.next()
    try:
        id_idx = headers.index(id_colname)
    except ValueError:
        logging.error('node id column name not present in %s' % csvfile)
        sys.exit(NO_SUCH_HEADER)
    for row in reader:
        yield row[id_idx]
def read_nodes ( csvfile , id_colname ) : try : f = open ( csvfile ) except IOError : logging . error ( 'id file %s not present' % csvfile ) sys . exit ( NO_SUCH_NODE_FILE ) reader = csv . reader ( f ) headers = reader . next ( ) try : id_idx = headers . index ( id_colname ) except ValueError : logging . error ( 'node id column name not present in %s' % csvfile ) sys . exit ( NO_SUCH_HEADER ) for row in reader : yield row [ id_idx ]
Return a generator which yields the node ids from the given csv file.
Return a generator which yields the node ids from the given csv file .
"""Return a generator which yields the node ids from the given csv file.
    :param str csvfile: Path of the csv file to read node ids from.
    :param str id_colname: Name of the csv column for the ids.
    """
csvfile
Path of the csv file to read node ids from.
Path of the csv file to read node ids from .
id_colname
Name of the csv column for the ids.
Name of the csv column for the ids .