def read_csv(user_id, records_path, antennas_path=None, attributes_path=None, network=False, describe=True, warnings=True, errors=False):
    """
    Load user records from a CSV file.

    Parameters
    ----------

    user_id : str
        ID of the user (filename)

    records_path : str
        Path of the directory all the user files.

    antennas_path : str, optional
        Path of the CSV file containing (place_id, latitude, longitude) values.
        This allows antennas to be mapped to their locations.

    attributes_path : str, optional
        Path of the directory containing attributes files (``key, value`` CSV file).
        Attributes can for instance be variables such as like, age, or gender.
        Attributes can be helpful to compute specific metrics.

    network : bool, optional
        If network is True, bandicoot loads the network of the user's correspondants from the same path. Defaults to False.

    describe : boolean
        If describe is True, it will print a description of the loaded user to the standard output.

    errors : boolean
        If errors is True, returns a tuple (user, errors), where user is the user object and errors are the records which could not
        be loaded.


    Examples
    --------

    >>> user = bandicoot.read_csv('sample_records', '.')
    >>> print len(user.records)
    10

    >>> user = bandicoot.read_csv('sample_records', 'samples', sample_places.csv')
    >>> print len(user.antennas)
    5

    >>> user = bandicoot.read_csv('sample_records', '.', None, 'sample_attributes.csv')
    >>> print user.attributes['age']
    25

    Notes
    -----
    - The csv files can be single, or double quoted if needed.
    - Empty cells are filled with ``None``. For example, if the column
      ``call_duration`` is empty for one record, its value will be ``None``.
      Other values such as ``"N/A"``, ``"None"``, ``"null"`` will be
      considered as a text.
    """

    antennas = None
    if antennas_path is not None:
        with open(antennas_path, 'rb') as csv_file:
            reader = csv.DictReader(csv_file)
            antennas = dict((d['place_id'], (float(d['latitude']),
                                             float(d['longitude'])))
                            for d in reader)

    user_records = os.path.join(records_path, user_id + '.csv')
    with open(user_records, 'rb') as csv_file:
        reader = csv.DictReader(csv_file)
        records = map(_parse_record, reader)

    attributes = None
    if attributes_path is not None:
        user_attributes = os.path.join(attributes_path, user_id + '.csv')
        try:
            with open(user_attributes, 'rb') as csv_file:
                reader = csv.DictReader(csv_file)
                attributes = dict((d['key'], d['value']) for d in reader)
        except __HOLE__:
            attributes = None

    user, bad_records = load(user_id, records, antennas, attributes, antennas_path,
                             attributes_path=attributes_path, describe=False, warnings=warnings)

    # Loads the network
    if network is True:
        user.network = _read_network(user, records_path, attributes_path, read_csv, antennas_path)
        user.recompute_missing_neighbors()

    if describe:
        user.describe()

    if errors:
        return user, bad_records
    return user
dataset/ETHPy150Open yvesalexandre/bandicoot/bandicoot/io.py/read_csv