<jupyter_start><jupyter_text>Load CSV file into memory<jupyter_code>data = pandas.read_csv('uber-raw-data-apr14.csv')
data.tail()
data['Date/Time'] = data['Date/Time'].map(pandas.to_datetime)
data.tail()
def get_dom(dt):
    return dt.day

data['dom'] = data['Date/Time'].map(get_dom)
data.tail()
def get_weekday(dt):
    return dt.weekday()

data['weekday'] = data['Date/Time'].map(get_weekday)

def get_hour(dt):
    return dt.hour

data['hour'] = data['Date/Time'].map(get_hour)

data.tail()<jupyter_output><empty_output><jupyter_text>Analyze the dom<jupyter_code>hist(data.dom, bins=30, rwidth=.8, range=(0.5, 30.5))
xlabel('date of the month')
ylabel('frequency')
title('Frequency by DoM - uber - Apr 2014')
#for k, rows in data.groupby('dom'):
#    print((k, len(rows)))
 
def count_rows(rows):
    return len(rows)

by_date = data.groupby('dom').apply(count_rows)
by_date

bar(range(1, 31), by_date)
by_date_sorted = by_date.sort_values()
by_date_sorted
bar(range(1, 31), by_date_sorted)
xticks(range(1,31), by_date_sorted.index)
xlabel('date of the month')
ylabel('frequency')
title('Frequency by DoM - uber - Apr 2014')
;<jupyter_output><empty_output><jupyter_text>Analyze by the hour<jupyter_code>hist(data.hour, bins=24, range=(.5, 24))<jupyter_output><empty_output><jupyter_text>Analyze by the weekday<jupyter_code>hist(data.weekday, bins=7, range =(-.5,6.5), rwidth=.8, color='#AA6666', alpha=.4)
xticks(range(7), 'Mon Tue Wed Thu Fri Sat Sun'.split())<jupyter_output><empty_output><jupyter_text>Cross analysis(hour, dow)<jupyter_code>by_cross = data.groupby('weekday hour'.split()).apply(count_rows).unstack()
seaborn.heatmap(by_cross)<jupyter_output><empty_output><jupyter_text>by lat and lon<jupyter_code>hist(data['Lat'], bins=100, range = (40.5, 41))
;
hist(data['Lon'], bins=100, range = (-74.1, -73.9));
hist(data['Lon'], bins=100, range = (-74.1, -73.9), color='g', alpha=.5, label = 'longitude')
grid()
legend(loc='upper left')
twiny()
hist(data['Lat'], bins=100, range = (40.5, 41), color='r', alpha=.5, label = 'latitude')
legend(loc='best')
;
figure(figsize=(20, 20))
plot(data['Lon'], data['Lat'], '.', ms=1, alpha=.5)
xlim(-74.2, -73.7)
ylim(40.7, 41)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19972826086956522, 'fraction_numerical': 0.043478260869565216, 'mean_word_length': 7.032727272727273, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '626367', 'license': 'MIT', 'n_tokens_mistral': 970, 'n_tokens_neox': 892, 'n_words': 157, 'path': 'Uber data analysis.ipynb', 'repo_name': 'Zumrannain/data-analysis', 'size': '2208'}