import csv


def load_data(path_to_csv, num_samples=None):
    """
    Read the csv file given and return the path to images and steering angles
    """
    image_path = []
    steering_angle = []
    with open(path_to_csv, "r", newline='') as f:
        recorded_data = csv.reader(f, delimiter=',', quotechar='|')
        for line in recorded_data:
            image_path.append(line[0])
            steering_angle.append(float(line[1]))
    
    if num_samples is not None:
        image_path = image_path[:num_samples]
        steering_angle = steering_angle[:num_samples]
    
    return image_path, steering_angle