<jupyter_start><jupyter_text>Pulling out file names<jupyter_code>file_names = []
for name in glob.glob('d/google_distance_matrix_data/*'):
    name = name.split('/')[-1]
    file_names.append(name)
file_names<jupyter_output><empty_output><jupyter_text>Creating one DF, and clean out columns I don't need<jupyter_code>df = pd.read_csv('d/google_distance_matrix_data/-499.csv')
for file in file_names[1:]:
    df_new = pd.read_csv('d/google_distance_matrix_data/'+ file)
    frames = [df, df_new]
    df = pd.concat(frames)
df = df.reset_index()
del df['Unnamed: 0']
del df['Timestamp index.1']
del df['index']
del df['Timestamp index']
del df['Timestamp']
df.info()<jupyter_output><empty_output><jupyter_text>What am I looking for? 0. Time Frame1. The distance, time and usage count of the top three bikes?2. Average time, distance and usage count?3. Total number of km, time, usages?4. What time of day, day of week do most people use the bike?5. Estimation of earnings?  1. Time Frame<jupyter_code>def pmam(x):
    x = str(x)
    #x = (':'.join(a+b for a,b in zip(x[::2], x[1::2])))
    if x == 'NaN':
        pass
    try:
        x = str(x[:2] + ':' + x[2:])
        date = dateutil.parser.parse(x)
        return str(date.strftime('%Y.%m.%d. %H:%M:%S'))
    except:
        return 'NaN'
df['Timestamp index'] = df['Timestamp +2'].apply(pmam)
df['Timestamp index'] = df['Timestamp index'].apply(lambda x: 
                                    dt.datetime.strptime(x,'%Y.%m.%d. %H:%M:%S'))
print('Starting date:', list(df['Timestamp index'].sort_values())[0])
print('End date', list(df['Timestamp index'].sort_values())[-1])<jupyter_output><empty_output><jupyter_text>2. The distance, time and usage count of the top three bikes?<jupyter_code>df.groupby('id')['Metres'].sum().sort_values(ascending=False).head(3)
df.groupby('id')['Metres'].sum().sort_values(ascending=False).plot(kind='bar').axes.get_xaxis().set_visible(False)
for elem in list(df.groupby('id')['Seconds'].sum().sort_values(ascending=False).head(3)):
    m, s = divmod(elem, 60)
    h, m = divmod(m, 60)
    print(h, 'h', m, 'min', s, 'sec')
df['id'].value_counts(ascending=False).head(3)<jupyter_output><empty_output><jupyter_text>3. Average time, distance and usage count?<jupyter_code>m, s = divmod(int(df['Seconds'].mean()), 60) 
print('Median time bike is in use is:', m, 'min', s, 'sec.')
m = int(df['Metres'].mean()) 
print('Average distance of a bike:', m, 'm')
u = str(round(df['id'].value_counts().mean() / 14,1))
print('Daily amount of times a bik is used:', u)<jupyter_output><empty_output><jupyter_text>4. What time of day, day of week do most people use the bike?<jupyter_code>df.index = df['Timestamp index']
df.groupby(by=df.index.hour)['id'].count().plot(kind='bar', figsize=(12,6))
df.groupby(by=df.index.weekday)['id'].count().plot(kind='bar', figsize=(12,6))<jupyter_output><empty_output><jupyter_text>6. Estimation of earnings?<jupyter_code>print('Considering every half our started cost 1.50 CHF, we multplying count of lines with that amount:', int(len(df.index)) * 1.5)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18440634098997088, 'fraction_numerical': 0.015852474927208024, 'mean_word_length': 5.221327967806841, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '644242', 'license': 'MIT', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1132, 'n_words': 255, 'path': '04 google_matrix_distance_analysis.ipynb', 'repo_name': 'morgulbrut/obike', 'size': '3091'}