<jupyter_start><jupyter_text>SeattleThis notebooks displays some of the data available at [Pronto Open Data](http://www.prontocycleshare.com/data). We assume the data was downloaded.<jupyter_code>from jyquickhelper import add_notebook_menu
add_notebook_menu()
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Data<jupyter_code>from pyensae.datasource import download_data
file = download_data("open_data_2016-12.zip", url="https://s3.amazonaws.com/pronto-data/")<jupyter_output><empty_output><jupyter_text>Stations<jupyter_code>import pandas
stations = df = pandas.read_csv("2016-12_station_data.csv")
df.head()
import folium
from pyensae.notebookhelper import folium_html_map
minx, maxx = df.lat.min(), df.lat.max()
miny, maxy = df.long.min(), df.long.max()
map_osm = folium.Map(location=[47.618549, -122.317017], 
                     min_lat=minx, max_lat=maxx, min_lon=miny, max_lon=maxy, zoom_start=12)
for i, rows in enumerate(df.to_dict("records")):
    x, y = rows["lat"], rows["long"]
    # folium does not like quotes in strings.
    name = rows["name"].replace("/", "-").replace("'", '')
    if len(name) > 15:
        name = name[:15]
    map_osm.add_child(folium.CircleMarker([x, y], popup=name, radius=5))
folium_html_map(map_osm, width="80%")<jupyter_output><empty_output><jupyter_text>Trips<jupyter_code>bikes = df = pandas.read_csv("2016-12_trip_data.csv")
df.head()
df.shape
df["dtstart"] = pandas.to_datetime(df.starttime, infer_datetime_format=True)
df["dtstop"] = pandas.to_datetime(df.stoptime, infer_datetime_format=True)
from datetime import datetime, time
df["day"] = df.dtstart.apply(lambda d: d.timetuple().tm_yday)
df["time"] = df.dtstart.apply(lambda r: time(r.hour, r.minute, 0))
df.day.hist(figsize=(14,4), bins=100)
icro = df.time.apply(lambda t: t.hour * 60 + t.minute)
icro.min(), icro.max()
icro.hist(figsize=(14,4), bins=100)
june = df[(df.dtstart >= datetime(2016,6,1)) & (df.dtstart < datetime(2016,7,1))]
june.day.hist(figsize=(14,4), bins=30)
june11 = june[(june.dtstart >= datetime(2016,6,11)) & (june.dtstart < datetime(2016,6,12))].copy()
june11[["from_station_id", "trip_id"]].groupby("from_station_id") \
         .count().sort_values("trip_id", ascending=False).head(n=20)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17027863777089783, 'fraction_numerical': 0.04290137107474569, 'mean_word_length': 6.320388349514563, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 20, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '25024', 'license': 'MIT', 'n_tokens_mistral': 936, 'n_tokens_neox': 863, 'n_words': 140, 'path': '_doc/notebooks/challenges/city_bike/bike_seatle.ipynb', 'repo_name': 'sdpython/ensae_projects', 'size': '2261'}