<commit_before>import pandas as pd
import folium

def df_to_string_list(df):
    """
    Convert the input df into a list of strings, suitable for using as popups in a map.
    This is a utility function.
    """
    # print "Converting df with size %s to string list" % df.shape[0]
    array_list = df.as_matrix().tolist()
    return [str(line) for line in array_list]

def get_map_list(df, potential_splits):
    mapList = []
    potential_splits_list = list(potential_splits)
    for start, end in zip(potential_splits_list, potential_splits_list[1:]):
        trip = df[start:end]
        print "Considering trip from %s to %s because start = %d and end = %d" % (df.formatted_time.iloc[start], df.formatted_time.iloc[end], start, end)
        if end - start < 4:
            # If there are only 3 entries, that means that there is only one
            # point other than the start and the end, bail
            print "Ignoring trip from %s to %s because start = %d and end = %d" % (df.formatted_time.iloc[start], df.formatted_time.iloc[end], start, end)
            continue
        currMap = folium.Map([trip.mLatitude.mean(), trip.mLongitude.mean()])
        currMap.div_markers(trip[['mLatitude', 'mLongitude']].as_matrix().tolist(),
            df_to_string_list(trip[['mLatitude', 'mLongitude', 'formatted_time', 'mAccuracy']]))
        currMap.line(trip[['mLatitude', 'mLongitude']].as_matrix().tolist())
        mapList.append(currMap)
    return mapList<commit_msg>Minor improvements to the plotting code<commit_after>import pandas as pd
import folium

def df_to_string_list(df):
    """
    Convert the input df into a list of strings, suitable for using as popups in a map.
    This is a utility function.
    """
    # print "Converting df with size %s to string list" % df.shape[0]
    array_list = df.to_dict(orient='records')
    return [str(line) for line in array_list]

def get_map_list(df, potential_splits):
    mapList = []
    potential_splits_list = list(potential_splits)
    for start, end in zip(potential_splits_list, potential_splits_list[1:]):
        trip = df[start:end]
        print "Considering trip from %s to %s because start = %d and end = %d" % (df.formatted_time.loc[start], df.formatted_time.loc[end], start, end)
        if end - start < 4:
            # If there are only 3 entries, that means that there is only one
            # point other than the start and the end, bail
            print "Ignoring trip from %s to %s because start = %d and end = %d" % (df.formatted_time.loc[start], df.formatted_time.loc[end], start, end)
            continue
        currMap = folium.Map([trip.mLatitude.mean(), trip.mLongitude.mean()])
        currMap.div_markers(trip[['mLatitude', 'mLongitude']].as_matrix().tolist(),
            df_to_string_list(trip), marker_size=5)
        currMap.line(trip[['mLatitude', 'mLongitude']].as_matrix().tolist())
        mapList.append(currMap)
    return mapList
{'fraction_non_alphanumeric': 0.11750681198910082, 'fraction_numerical': 0.0030653950953678476, 'mean_word_length': 3.2503617945007237, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3134378', 'n_tokens_mistral': 964, 'n_tokens_neox': 935, 'n_words': 276}