In [1]:
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline

import numpy as np

import requests
from xml.etree import ElementTree

In [2]:
response = requests.get('https://www.capitalbikeshare.com/data/stations/bikeStations.xml')

In [3]:
tree = ElementTree.fromstring(response.content)

In [4]:
data = []
columns = ['id', 'name', 'lat', 'long', 'temporary', 'public', 'nbBikes', 'nbEmptyDocks']
for station in tree:
    data.append({c : station.find(c).text for c in columns})
    
data = pd.DataFrame(data)
for i in ['id', 'lat', 'long', 'nbBikes', 'nbEmptyDocks']:
    data[i] = pd.to_numeric(data[i])

In [5]:
data.plot(x='long', y='lat', kind='scatter')


Out[5]:
<matplotlib.axes._subplots.AxesSubplot at 0x2351c1752b0>

In [7]:
len(data)


Out[7]:
441

In [8]:
data.to_csv('stations.csv')

In [13]:
import polyline
import requests

url_polyline = 'http://192.168.99.100:5000/table/v1/bike/polyline({0})'
url = 'http://192.168.99.100:5000/table/v1/bike/{0}'

c = []
for i,r in data.iterrows():
    if i < 20:
        c.append((r['lat'], r['long']))
#print(c)
p = polyline.encode(c, 5)

print(p)

coord_l = ';'.join(['{0},{1}'.format(r['long'], r['lat']) for i,r in data.iterrows() if i < 10])
print(coord_l)

res = requests.get(url_polyline.format(p))
#res = requests.get(url.format(coords_l))


qsdlFtmhuMvIPbDqXkVfAjMz|@uZxAwG~Sjf@akAka@lIjyA_Gnc@gG{aAoAhOvIauH{t@ckBobAciAwY`Tnu@vRvd@eW{_AnUn_B
-77.05323,38.858971000000004;-77.05332,38.85725;-77.04923199999999,38.856425;-77.049593,38.860170000000004;-77.05949,38.857865999999994;-77.059936,38.862303000000004;-77.0633,38.8637;-77.05113172531128,38.857404962615036;-77.0528,38.8629;-77.051516,38.848440999999994

In [14]:
res.json()


Out[14]:
{'code': 'Ok',
 'destinations': [{'hint': '01oNgP-MDoDk6wMABQAAAOEAAACLAQAAAAAAAAUAAADhAAAAiwEAAAAAAADk5wcAWgAAAGJCaPvM8FAC0kJo-9rwUAIGAAICxto8gA==',
   'location': [-77.053342, 38.858956],
   'name': 'South Eads Street'},
  {'hint': '0loNgBwhFYAA7QEAMwAAAKMAAAAAAAAAGQAAADMAAACjAAAAAAAAABkAAADj5wcAWgAAAGlCaPtt6lACeEJo-yLqUAIAAAYCxto8gA==',
   'location': [-77.053335, 38.857325],
   'name': '18th Street South'},
  {'hint': 'RkAGgEhABoAQ8gMA8QAAAFIAAAA8AAAAAAAAAPEAAABSAAAAPAAAAAAAAAAM3AMAWgAAABJSaPvx5lACclJo--7mUAIBAAICxto8gA==',
   'location': [-77.049326, 38.856433],
   'name': 'South Crystal Drive'},
  {'hint': 'CI0OgMLlDoBU6wEAVQAAAD0AAABqAQAAAAAAAFUAAAA9AAAAagEAAAAAAADzgQgAWgAAAA5RaPsx9VACClFo-4r1UAICAAYCxto8gA==',
   'location': [-77.049586, 38.860081],
   'name': '15th Street South'},
  {'hint': 'rqgMgNSoDIAAAAAABAAAAC4AAAAAAAAAAAAAAAQAAAAuAAAAAAAAAAAAAABXiQcAWgAAAG4qaPuc7FACXipo-47sUAIAAAYGxto8gA==',
   'location': [-77.059474, 38.857884],
   'name': ''},
  {'hint': 'SaYMgHGmDIAAAAAAxgAAAFYAAAA0AQAA0AMAAMYAAABWAAAANAEAANADAADshwcAWgAAALEoaPvY_VACnCho-9z9UAIDAAYGxto8gA==',
   'location': [-77.059919, 38.862296],
   'name': ''},
  {'hint': '96UMgPylDIAAAAAABgEAABAAAAAAAAAAcwQAAAYBAAAQAAAAAAAAAHMEAAC7hwcAWgAAAEUbaPtdA1ECfBto-1QDUQIAAAYGxto8gA==',
   'location': [-77.063355, 38.863709],
   'name': ''},
  {'hint': 'bTkGgA2NDoBw5AMALAAAAAUAAAAYAQAAQgAAACwAAAAFAAAAGAEAAEIAAADg1gMAWgAAAGNLaPu26lACBkto-7jqUAICAAICxto8gA==',
   'location': [-77.051037, 38.857398],
   'name': 'South Bell Street'},
  {'hint': 'oTgGgMpUBoDk8AEAugAAAA0BAAAAAAAAJwAAALoAAAANAQAAAAAAACcAAAAv1gMAWgAAAIdEaPuCAFECgERo-zQAUQIAAAICxto8gA==',
   'location': [-77.052793, 38.862978],
   'name': '12th Street South'},
  {'hint': 'ZOASgI7GFYBwXQQABQAAAGwAAAAOAAAAQgEAAAUAAABsAAAADgAAAEIBAADFawoAWgAAAMhJaPugx1ACgElo-7jHUAIBAAIGxto8gA==',
   'location': [-77.051448, 38.848416],
   'name': 'Crystal Drive'},
  {'hint': 'YOASgFl1E4AwXQQADAAAABEAAAAeAAAAHgEAAAwAAAARAAAAHgAAAB4BAADDawoAWgAAAG9OaPvcsFACqE5o--iwUAIBAAICxto8gA==',
   'location': [-77.050257, 38.842588],
   'name': 'Potomac Yard Trail'},
  {'hint': 'TkAGgAWlGoC87gEAiwAAAGIAAAAAAAAAAAAAAIsAAABiAAAAAAAAAAAAAAAT3AMAWgAAAC1QaPtW2lACOFBo-7TaUAIAAAYCxto8gA==',
   'location': [-77.049811, 38.853206],
   'name': '23rd Street South'},
  {'hint': 'T0AGgOdGBoAg7AEA8AAAAC4AAAAAAAAAAAAAAPAAAAAuAAAAAAAAAAAAAAAU3AMAWgAAAExJaPse0FACgElo-4LQUAIAAAICxto8gA==',
   'location': [-77.051572, 38.85059],
   'name': '26th Street South'},
  {'hint': 'LlMNgO1FEIAcaQEAxAAAAFcAAAAAAAAAHwAAAMQAAABXAAAAAAAAAB8AAACK4wcAWgAAACxraPvwkVECLGto-0ySUQIAAAYCxto8gA==',
   'location': [-77.0429, 38.900208],
   'name': 'H Street Northwest'},
  {'hint': 'QygegFUoHoBoYwEAdgAAAH8AAAAAAAAAAAAAAHYAAAB_AAAAAAAAAAAAAABHHg8AWgAAAPCVaPvg1VECXJVo--DVUQIAAAICxto8gA==',
   'location': [-77.031952, 38.9176],
   'name': '14th Street Northwest'},
  {'hint': 'ztQcgNHUHIAAAAAAJQAAAL0AAAAAAAAAAAAAACUAAAC9AAAAAAAAAAAAAACqnQ4AWgAAAGGmaPs_BFICFKZo-zQEUgIAAAICxto8gA==',
   'location': [-77.027743, 38.929471],
   'name': ''},
  {'hint': 'HYoEgJa6HICQcgEANwAAAB8AAAAAAAAAAAAAADcAAAAfAAAAAAAAAAAAAABW4gIAWgAAAEaEaPsK91ECBIRo-wr3UQIAAAICxto8gA==',
   'location': [-77.036474, 38.92609],
   'name': '16th Street Northwest'},
  {'hint': 'Cu4ZgA7uGYAAAAAABgAAABcAAAAgAAAAAAAAAAYAAAAXAAAAIAAAAAAAAAANdA0AWgAAAGRsaPuD6lECbGxo-7LqUQIBAAYGxto8gA==',
   'location': [-77.042588, 38.922883],
   'name': ''},
  {'hint': 'CIoEgG3THIAAAAAANQAAAAAAAAAAAAAATAAAADUAAAAAAAAAAAAAAEwAAABH4gIAWgAAAIWUaPtw-VEC-JRo-9D5UQIAAAYGxto8gA==',
   'location': [-77.032315, 38.926704],
   'name': ''},
  {'hint': 'OjobgEM6G4AAAAAALwAAAF4FAAAqAAAAwQAAAC8AAABeBQAAKgAAAMEAAACV9Q0AWgAAAKVYaPuq61ECqFho-8DrUQIBAAYGxto8gA==',
   'location': [-77.047643, 38.923178],
   'name': ''}],
 'durations': [[0,
   55.7,
   174.9,
   143.8,
   269.6,
   303.8,
   370,
   110.9,
   151.4,
   363.7,
   531,
   246.9,
   282.8,
   1748.6,
   2296.8,
   2652.9,
   2424.6,
   2287.9,
   2501.7,
   2332.1],
  [58.9,
   0,
   124.5,
   178.3,
   218.2,
   327.9,
   390.4,
   60.5,
   210.3,
   329,
   496.3,
   212.2,
   248.1,
   1807.5,
   2264,
   2648,
   2483.5,
   2346.8,
   2522,
   2391],
  [167.5,
   142.9,
   0,
   112.5,
   346.7,
   462.4,
   518.7,
   88.7,
   254.9,
   220.6,
   409.9,
   104.8,
   196.8,
   1896.4,
   2198.2,
   2582.2,
   2472.7,
   2455.3,
   2456.2,
   2499.5],
  [124.4,
   169.5,
   118.7,
   0,
   373.3,
   361.1,
   417.7,
   104.8,
   181.6,
   339.3,
   528.6,
   223.5,
   306.9,
   1808.2,
   2224.9,
   2608.9,
   2484.2,
   2347.5,
   2482.9,
   2391.7],
  [251.9,
   193,
   317.5,
   371.3,
   0,
   291.3,
   353.8,
   253.5,
   369.2,
   489.8,
   657.1,
   362,
   408.9,
   1912.2,
   2457,
   2816.5,
   2588.2,
   2451.5,
   2665.3,
   2495.7],
  [292.1,
   327.4,
   451.9,
   370.2,
   284.3,
   0,
   318.5,
   387.9,
   204.6,
   634.7,
   802,
   506.9,
   553.8,
   1754.3,
   2302.5,
   2658.6,
   2430.3,
   2293.6,
   2507.4,
   2337.8],
  [377.1,
   394.7,
   519.2,
   465.7,
   351.6,
   310.3,
   0,
   455.2,
   375,
   707.9,
   875.2,
   580.1,
   627,
   1751.5,
   2299.7,
   2655.8,
   2427.5,
   2290.8,
   2504.6,
   2335],
  [98.9,
   74.3,
   89.6,
   132.4,
   278.1,
   393.8,
   450.1,
   0,
   250.3,
   298.6,
   471,
   182.8,
   222.8,
   1847.5,
   2229.1,
   2613.1,
   2503.6,
   2386.8,
   2487.1,
   2431],
  [155.6,
   211.3,
   253.8,
   165.6,
   367.3,
   212.3,
   394.6,
   208.1,
   0,
   470.3,
   637.6,
   355.7,
   389.4,
   1669.3,
   2217.5,
   2573.6,
   2345.3,
   2208.6,
   2422.4,
   2252.8],
  [383.5,
   354.1,
   220.6,
   333.1,
   498.8,
   655.5,
   718.5,
   296.5,
   475.5,
   0,
   189.3,
   157.3,
   84.9,
   2117,
   2418.8,
   2802.8,
   2693.3,
   2671.4,
   2676.8,
   2715.6],
  [554,
   524.6,
   407,
   519.5,
   658,
   830.2,
   893.2,
   482.9,
   661.9,
   186.4,
   0,
   343.7,
   271.3,
   2302.6,
   2605.2,
   2989.2,
   2879.7,
   2841.9,
   2863.2,
   2886.1],
  [267.8,
   243.2,
   100.3,
   212.8,
   390.7,
   547.4,
   610.4,
   176.2,
   355.2,
   144.1,
   333.4,
   0,
   120.3,
   1996.7,
   2298.5,
   2682.5,
   2573,
   2555.6,
   2556.5,
   2599.8],
  [298.6,
   269.2,
   201.6,
   314.1,
   413.9,
   570.6,
   633.6,
   253,
   450,
   80.9,
   270.2,
   136.8,
   0,
   2047.2,
   2399.8,
   2783.8,
   2674.3,
   2586.5,
   2657.8,
   2630.7],
  [1787.9,
   1843.6,
   1864.4,
   1868.8,
   1917.4,
   1763.7,
   1793.1,
   1894.5,
   1712.6,
   2085,
   2274.3,
   1969.2,
   2061.2,
   0,
   675.3,
   1031.4,
   803.1,
   685.7,
   880.2,
   782.4],
  [2301.3,
   2276.7,
   2200.6,
   2213,
   2480.5,
   2357.1,
   2386.5,
   2234.7,
   2306,
   2421.2,
   2610.5,
   2305.4,
   2397.4,
   698.9,
   0,
   416.4,
   336.6,
   389.8,
   258,
   515.9],
  [2689.1,
   2664.5,
   2588.4,
   2600.8,
   2868.3,
   2720.3,
   2749.7,
   2622.5,
   2669.2,
   2809,
   2998.3,
   2693.2,
   2785.2,
   1062.1,
   415.8,
   0,
   272.5,
   448.7,
   216,
   578.2],
  [2511.3,
   2537.5,
   2461.4,
   2473.8,
   2640.8,
   2487.1,
   2516.5,
   2495.5,
   2436,
   2682,
   2871.3,
   2566.2,
   2658.2,
   828.9,
   336.8,
   293.7,
   0,
   223,
   114.7,
   352.5],
  [2383.6,
   2439.3,
   2461.5,
   2464.5,
   2513.1,
   2359.4,
   2388.8,
   2490.2,
   2308.3,
   2682.1,
   2871.4,
   2566.3,
   2658.3,
   702,
   391,
   479.5,
   206.5,
   0,
   300.5,
   156.2],
  [2561.5,
   2536.9,
   2460.8,
   2473.2,
   2726.4,
   2572.7,
   2602.1,
   2494.9,
   2521.6,
   2681.4,
   2870.7,
   2565.6,
   2657.6,
   914.5,
   260.2,
   205.8,
   157.7,
   333.9,
   0,
   463.4],
  [2389.5,
   2445.2,
   2508.2,
   2470.4,
   2519,
   2365.3,
   2394.7,
   2496.1,
   2314.2,
   2728.8,
   2918.1,
   2613,
   2672.3,
   718.2,
   491.5,
   593.9,
   320.9,
   160.6,
   414.9,
   0]],
 'sources': [{'hint': '01oNgP-MDoDk6wMABQAAAOEAAACLAQAAAAAAAAUAAADhAAAAiwEAAAAAAADk5wcAWgAAAGJCaPvM8FAC0kJo-9rwUAIGAAICxto8gA==',
   'location': [-77.053342, 38.858956],
   'name': 'South Eads Street'},
  {'hint': '0loNgBwhFYAA7QEAMwAAAKMAAAAAAAAAGQAAADMAAACjAAAAAAAAABkAAADj5wcAWgAAAGlCaPtt6lACeEJo-yLqUAIAAAYCxto8gA==',
   'location': [-77.053335, 38.857325],
   'name': '18th Street South'},
  {'hint': 'RkAGgEhABoAQ8gMA8QAAAFIAAAA8AAAAAAAAAPEAAABSAAAAPAAAAAAAAAAM3AMAWgAAABJSaPvx5lACclJo--7mUAIBAAICxto8gA==',
   'location': [-77.049326, 38.856433],
   'name': 'South Crystal Drive'},
  {'hint': 'CI0OgMLlDoBU6wEAVQAAAD0AAABqAQAAAAAAAFUAAAA9AAAAagEAAAAAAADzgQgAWgAAAA5RaPsx9VACClFo-4r1UAICAAYCxto8gA==',
   'location': [-77.049586, 38.860081],
   'name': '15th Street South'},
  {'hint': 'rqgMgNSoDIAAAAAABAAAAC4AAAAAAAAAAAAAAAQAAAAuAAAAAAAAAAAAAABXiQcAWgAAAG4qaPuc7FACXipo-47sUAIAAAYGxto8gA==',
   'location': [-77.059474, 38.857884],
   'name': ''},
  {'hint': 'SaYMgHGmDIAAAAAAxgAAAFYAAAA0AQAA0AMAAMYAAABWAAAANAEAANADAADshwcAWgAAALEoaPvY_VACnCho-9z9UAIDAAYGxto8gA==',
   'location': [-77.059919, 38.862296],
   'name': ''},
  {'hint': '96UMgPylDIAAAAAABgEAABAAAAAAAAAAcwQAAAYBAAAQAAAAAAAAAHMEAAC7hwcAWgAAAEUbaPtdA1ECfBto-1QDUQIAAAYGxto8gA==',
   'location': [-77.063355, 38.863709],
   'name': ''},
  {'hint': 'bTkGgA2NDoBw5AMALAAAAAUAAAAYAQAAQgAAACwAAAAFAAAAGAEAAEIAAADg1gMAWgAAAGNLaPu26lACBkto-7jqUAICAAICxto8gA==',
   'location': [-77.051037, 38.857398],
   'name': 'South Bell Street'},
  {'hint': 'oTgGgMpUBoDk8AEAugAAAA0BAAAAAAAAJwAAALoAAAANAQAAAAAAACcAAAAv1gMAWgAAAIdEaPuCAFECgERo-zQAUQIAAAICxto8gA==',
   'location': [-77.052793, 38.862978],
   'name': '12th Street South'},
  {'hint': 'ZOASgI7GFYBwXQQABQAAAGwAAAAOAAAAQgEAAAUAAABsAAAADgAAAEIBAADFawoAWgAAAMhJaPugx1ACgElo-7jHUAIBAAIGxto8gA==',
   'location': [-77.051448, 38.848416],
   'name': 'Crystal Drive'},
  {'hint': 'YOASgFl1E4AwXQQADAAAABEAAAAeAAAAHgEAAAwAAAARAAAAHgAAAB4BAADDawoAWgAAAG9OaPvcsFACqE5o--iwUAIBAAICxto8gA==',
   'location': [-77.050257, 38.842588],
   'name': 'Potomac Yard Trail'},
  {'hint': 'TkAGgAWlGoC87gEAiwAAAGIAAAAAAAAAAAAAAIsAAABiAAAAAAAAAAAAAAAT3AMAWgAAAC1QaPtW2lACOFBo-7TaUAIAAAYCxto8gA==',
   'location': [-77.049811, 38.853206],
   'name': '23rd Street South'},
  {'hint': 'T0AGgOdGBoAg7AEA8AAAAC4AAAAAAAAAAAAAAPAAAAAuAAAAAAAAAAAAAAAU3AMAWgAAAExJaPse0FACgElo-4LQUAIAAAICxto8gA==',
   'location': [-77.051572, 38.85059],
   'name': '26th Street South'},
  {'hint': 'LlMNgO1FEIAcaQEAxAAAAFcAAAAAAAAAHwAAAMQAAABXAAAAAAAAAB8AAACK4wcAWgAAACxraPvwkVECLGto-0ySUQIAAAYCxto8gA==',
   'location': [-77.0429, 38.900208],
   'name': 'H Street Northwest'},
  {'hint': 'QygegFUoHoBoYwEAdgAAAH8AAAAAAAAAAAAAAHYAAAB_AAAAAAAAAAAAAABHHg8AWgAAAPCVaPvg1VECXJVo--DVUQIAAAICxto8gA==',
   'location': [-77.031952, 38.9176],
   'name': '14th Street Northwest'},
  {'hint': 'ztQcgNHUHIAAAAAAJQAAAL0AAAAAAAAAAAAAACUAAAC9AAAAAAAAAAAAAACqnQ4AWgAAAGGmaPs_BFICFKZo-zQEUgIAAAICxto8gA==',
   'location': [-77.027743, 38.929471],
   'name': ''},
  {'hint': 'HYoEgJa6HICQcgEANwAAAB8AAAAAAAAAAAAAADcAAAAfAAAAAAAAAAAAAABW4gIAWgAAAEaEaPsK91ECBIRo-wr3UQIAAAICxto8gA==',
   'location': [-77.036474, 38.92609],
   'name': '16th Street Northwest'},
  {'hint': 'Cu4ZgA7uGYAAAAAABgAAABcAAAAgAAAAAAAAAAYAAAAXAAAAIAAAAAAAAAANdA0AWgAAAGRsaPuD6lECbGxo-7LqUQIBAAYGxto8gA==',
   'location': [-77.042588, 38.922883],
   'name': ''},
  {'hint': 'CIoEgG3THIAAAAAANQAAAAAAAAAAAAAATAAAADUAAAAAAAAAAAAAAEwAAABH4gIAWgAAAIWUaPtw-VEC-JRo-9D5UQIAAAYGxto8gA==',
   'location': [-77.032315, 38.926704],
   'name': ''},
  {'hint': 'OjobgEM6G4AAAAAALwAAAF4FAAAqAAAAwQAAAC8AAABeBQAAKgAAAMEAAACV9Q0AWgAAAKVYaPuq61ECqFho-8DrUQIBAAYGxto8gA==',
   'location': [-77.047643, 38.923178],
   'name': ''}]}

In [29]:
import polyline
import requests

url_polyline = 'http://192.168.99.100:5000/trip/v1/bike/polyline({0})'
url = 'http://192.168.99.100:5000/table/v1/bike/{0}'

c = []
for i,r in data.iterrows():
    c.append((r['lat'], r['long']))
#print(c)
p = polyline.encode(c, 5)

print(p)

coord_l = ';'.join(['{0},{1}'.format(r['long'], r['lat']) for i,r in data.iterrows() if i < 10])
print(coord_l)

res = requests.get(url_polyline.format(p))
#res = requests.get(url.format(coords_l))
result = res.json()


qsdlFtmhuMvIPbDqXkVfAjMz|@uZxAwG~Sjf@akAka@lIjyA_Gnc@gG{aAoAhOvIauH{t@ckBobAciAwY`Tnu@vRvd@eW{_AnUn_Bku@gv@~wIgbCenE~fBuPgPnXzBzkAjnAc[nKg{EujCcH|q@bQchFfdE`rC~rAifGo`GftIzxL{pKqnMjvPt~I__RcvByqA_Zya@|pFvhIk\gh@}lDfzIgtCmkGvJx|Cco@cVf{HcfB{_GbrFS_kChbKtbEimCivHgrEj}FnZoqFfAh`GbO{q@|S{pClxAepA~\scBcVSsnDvgIyiEn|CtfE_zHvoEwpBcsJd}PbWayAqoAsxFl_OcsIol@cm@yuAd`DgnA~xEdb@gjOfi@rtNs|At`EqcEgiLdqFhzI`u@ewCgi@pVsYvwD`rAawJs`Cx_H}jG`kFtfH{xPfRtaEwJtxAoh@mfAiiCxbCzwCx@cA~uBvgD{aGqoB_vCofCh{L~cB{nFrBai@alEw{DreCjjAvcAgh@wAnU?gvBh`AflBcB}iAzcC{pDe_DhlDm`C|zHjjBm_A`WlVmP}y@w\xcBwi@jg@vsAerD~QxjDo_BhnDno@utNaWbcK|i@mnHaB~]_r@xjBaiB|lGdxCuoFxpI~sBsyFyW{tAoyB~IdnCsF|bC~OfGfFnXzIhr@{As_@`eDozW}fDlmQrT`~G}dEcpH|vAq]jCif@z_Bn_JjMbYn@fJ{hAklIjlAglCzRkHjQq`BcdE`~BwtDjQzcDaoAknAzfAv_AdhB|lDeeSe{FxbVzqEwsQut@x{QhnBgiMhiGpY_eEllV}^qVk_BclBga@wwJvfB~}L{~@uyBxkBuaMgrGl|Lae@atKd~GxuPkFf\wCsxA{Vs|Jk@aWz|@v~PcaBwtRhGd|KyOnQt`@kq@t{@r~@i@~_C}H_NpPw`MpqAaeIekBjuXlWaw@y[ii@}~Bs{SlHx{Ho@meBfMnpBcC}RfjRyQ_IvQsd@bGz`@r_@g{QeeBdyQfxBic@qOoRxN`v@lp@euRox@xaAc~Ca^xmCpjBfuKaGkbDqZo`A~EcmDmg@{Yye@idDekG~kJqcAl`@zqHeoNvdG~aNtd@`g@jgAalBudMelDkjFarCpi@`y@vn@f`@ayAz@xdTlfGjUtbAmeB`}@|rAuAn^uc@ie@_\}`Z{yItiNptEfoI`fFarRg~D~cHodE}}AwRjoEayFulCnkCdmCsuE_m@jfAmyD}aBzyDb\ocEbm@ztOts@g`Cmy@}wFuPspAx~FjrKn_NjpBsmBgbHoG`sAgtAw|BwvLum@~cCimCml@kBceAv`Dhx@b`@]aA|iAezFqqDjuKxmPne@xzC{_BsU{dUeqOzYtoMcPs_@}}TzrRxNl|@rpSguSitQduIdnQ{kIupSzeHhdUucYuMm^kgA|mC~gAt|K`gCqy@h}FeqIz~GiwDszGlpCxoG_bEuon@tv^d`C|`EdaByqF_xFpr@z_Yk_Xc}U~}VxmWovJgpBstPgqQvw]buS_lY~zA_nAiQs\iyAdhQzIZtsAib@ilWxsS~p@adL`nBts@w`Dd~EpkTuy[}h@bLvMed@k~Uvn[jZzdA`nc@{{XffBsxEft@ahOa}@vFvzD`~Qf\voJpl@a_Gi_Yt~JnoFebC`_KmqNtbK|wOe}EonAvVjsAi_MwpEcs^~fY`a@f@dqRuv`@sdP|xVlcc@qbYadIuy@ymCjwAzsIcbCxqIptN~dDlcActu@xlNjf]}fKeiVxnG`nRafIhoQgpCsrA{`@fiRi^_uPr_Ej~C`oA_tDktN|Cp`J}XayD`tRtnB_`CceCdvBlcBskBcd@yc@vDj^_a@}jA~h@qfJb{CywQwpOvyV|nHuqRniDd~J{_Gx_@x\gkR__@frOxl@vlI`eCwoHk}KdgAj_TwN_cDnUptB}QepIvgCrkOzvA_oJq_Is`GvhHh{JupEgmOaw@jvBkhIx^|`LmjIkI|oBuxBsx@c~Dt|QqjHoU}uTb_Vvlg@w~MzuO}lMnb@faBig@u_Ayhc@pmH|jUdyD_jM}kGrvDmmHndBD}~O`|AvzBtgGj{McaKc^axB~`NoYmbKxoEgbB|k@izOq}@pje@jd@qrW_lAz_SphBqvOiiChuCmGkgKxtFdeIkbKx~K`eOs_JftLdWo`CviLujM}l@zEewLy{GIxgEfNadAhqPx_AazGv~AcwJywHldK~qHhpGgy@mcCmd@obAJwiRs`Bt`D~TqeH~tGjgF{cTb~Aq~G|eDx_J_mJhmq@t_@i\tDaWvUicAcHzD{T{Zum@~HtQhe@gVfg@yhFzzS`n@`pCrAgRpHsNha@e\gKlq@vaM}adAokK|z_AmeAz_CxYaFbhKch{@|BemYuiL`|tAx\x|A`_Kwby@suDnq]`sTanc@wza@kwCr_MtpBvcFktGqsMvjAvwNbsT}oFz|ShlA_ij@_zTrfTlgEueVaa@TpmBhycA
-77.05323,38.858971000000004;-77.05332,38.85725;-77.04923199999999,38.856425;-77.049593,38.860170000000004;-77.05949,38.857865999999994;-77.059936,38.862303000000004;-77.0633,38.8637;-77.05113172531128,38.857404962615036;-77.0528,38.8629;-77.051516,38.848440999999994

Distance and duration for trip


In [39]:
print('Distance ', result['trips'][0]['distance'])
print('Duration ', result['trips'][0]['duration'] / (60 * 60))


Distance  425876.3
Duration  32.170861111111115

Formatting coordinates for map


In [66]:
waypoints = result['waypoints']
waypoints.sort(key=lambda x: x['waypoint_index'])

p = []
for i in waypoints:
    p.append(i['location'])
    print('L.latLng({0}, {1}),'.format(i['location'][1], i['location'][0]))

plt.plot([i[0] for i in p], [i[1] for i in p])


L.latLng(38.858956, -77.053342),
L.latLng(38.860081, -77.049586),
L.latLng(38.862978, -77.052793),
L.latLng(38.86464, -77.048585),
L.latLng(38.866491, -77.048292),
L.latLng(38.879786, -77.03741),
L.latLng(38.884113, -77.04658),
L.latLng(38.888271, -77.049394),
L.latLng(38.890523, -77.049345),
L.latLng(38.892441, -77.048854),
L.latLng(38.89246, -77.046671),
L.latLng(38.8923, -77.043483),
L.latLng(38.888128, -77.038317),
L.latLng(38.878294, -77.030046),
L.latLng(38.888593, -77.032412),
L.latLng(38.888785, -77.02858),
L.latLng(38.887239, -77.028177),
L.latLng(38.887311, -77.025863),
L.latLng(38.88438, -77.025785),
L.latLng(38.876809, -77.021187),
L.latLng(38.886323, -77.02224),
L.latLng(38.887243, -77.018867),
L.latLng(38.890467, -77.01725),
L.latLng(38.886961, -77.013617),
L.latLng(38.88412, -77.017556),
L.latLng(38.876716, -77.017703),
L.latLng(38.874299, -77.005807),
L.latLng(38.876438, -77.003699),
L.latLng(38.874897, -77.0024),
L.latLng(38.87861, -77.00589),
L.latLng(38.881135, -77.00183),
L.latLng(38.88492, -77.005893),
L.latLng(38.885066, -77.002299),
L.latLng(38.887381, -77.002042),
L.latLng(38.889845, -77.00035),
L.latLng(38.889844, -76.99519),
L.latLng(38.886884, -76.996801),
L.latLng(38.890461, -76.988268),
L.latLng(38.88972, -76.976884),
L.latLng(38.889843, -76.98333),
L.latLng(38.887321, -76.983651),
L.latLng(38.884103, -76.9861),
L.latLng(38.880284, -76.986109),
L.latLng(38.882489, -76.990242),
L.latLng(38.884184, -76.995275),
L.latLng(38.879284, -76.9953),
L.latLng(38.876702, -76.994445),
L.latLng(38.867321, -76.988056),
L.latLng(38.863869, -76.990042),
L.latLng(38.862636, -76.994621),
L.latLng(38.843217, -76.999503),
L.latLng(38.831446, -77.008143),
L.latLng(38.844807, -76.987857),
L.latLng(38.859989, -76.967242),
L.latLng(38.870759, -76.982344),
L.latLng(38.866599, -76.985177),
L.latLng(38.865698, -76.978137),
L.latLng(38.87306, -76.970937),
L.latLng(38.869117, -76.959957),
L.latLng(38.86559, -76.952216),
L.latLng(38.878016, -76.960822),
L.latLng(38.897048, -76.947426),
L.latLng(38.901494, -76.941978),
L.latLng(38.908633, -76.93331),
L.latLng(38.898583, -76.931848),
L.latLng(38.897428, -76.925988),
L.latLng(38.891811, -76.91366),
L.latLng(38.889897, -76.937231),
L.latLng(38.894035, -76.948046),
L.latLng(38.89656, -76.960058),
L.latLng(38.894425, -76.974747),
L.latLng(38.894783, -76.98763),
L.latLng(38.897199, -76.983645),
L.latLng(38.900588, -76.982774),
L.latLng(38.9003, -76.988308),
L.latLng(38.903807, -76.987155),
L.latLng(38.912594, -76.97192),
L.latLng(38.927099, -76.979003),
L.latLng(38.91497, -76.983317),
L.latLng(38.905161, -76.994109),
L.latLng(38.908037, -76.997041),
L.latLng(38.90288, -76.998444),
L.latLng(38.89997, -76.998369),
L.latLng(38.89998, -76.991525),
L.latLng(38.896206, -76.99295),
L.latLng(38.897332, -76.99475),
L.latLng(38.894775, -76.997109),
L.latLng(38.895038, -77.003094),
L.latLng(38.896955, -77.004907),
L.latLng(38.89967, -77.003607),
L.latLng(38.905642, -77.0056),
L.latLng(38.905644, -77.00304),
L.latLng(38.90041, -77.002038),
L.latLng(38.899701, -77.008985),
L.latLng(38.90036, -77.012169),
L.latLng(38.897338, -77.00989),
L.latLng(38.892247, -77.013919),
L.latLng(38.89534, -77.016185),
L.latLng(38.89457, -77.019902),
L.latLng(38.8948, -77.02324),
L.latLng(38.898328, -77.024279),
L.latLng(38.8997, -77.023038),
L.latLng(38.897364, -77.022191),
L.latLng(38.897242, -77.01935),
L.latLng(38.899411, -77.015223),
L.latLng(38.900868, -77.018679),
L.latLng(38.90304, -77.019071),
L.latLng(38.903567, -77.014108),
L.latLng(38.907059, -77.01517),
L.latLng(38.908689, -77.012371),
L.latLng(38.912602, -77.0135),
L.latLng(38.912629, -77.01767),
L.latLng(38.917595, -77.015903),
L.latLng(38.91542, -77.012156),
L.latLng(38.910973, -77.004968),
L.latLng(38.918199, -77.004714),
L.latLng(38.91908, -77.000568),
L.latLng(38.920684, -76.995896),
L.latLng(38.927424, -76.997191),
L.latLng(38.92858, -76.990955),
L.latLng(38.933667, -76.99109),
L.latLng(38.932445, -76.992885),
L.latLng(38.934589, -76.995594),
L.latLng(38.928847, -77.012652),
L.latLng(38.936015, -77.024593),
L.latLng(38.941791, -77.0251),
L.latLng(38.94202, -77.032682),
L.latLng(38.9375, -77.032777),
L.latLng(38.930724, -77.031457),
L.latLng(38.926704, -77.032315),
L.latLng(38.928663, -77.032178),
L.latLng(38.929471, -77.027743),
L.latLng(38.928055, -77.02378),
L.latLng(38.924847, -77.022192),
L.latLng(38.920344, -77.025758),
L.latLng(38.915571, -77.0222),
L.latLng(38.912627, -77.02216),
L.latLng(38.91376, -77.027035),
L.latLng(38.9172, -77.025994),
L.latLng(38.91679, -77.028083),
L.latLng(38.9176, -77.031952),
L.latLng(38.912634, -77.03168),
L.latLng(38.912633, -77.03628),
L.latLng(38.912202, -77.038701),
L.latLng(38.912628, -77.04183),
L.latLng(38.909991, -77.044432),
L.latLng(38.9089, -77.044881),
L.latLng(38.906581, -77.038779),
L.latLng(38.90814, -77.03838),
L.latLng(38.90985, -77.034557),
L.latLng(38.908697, -77.032355),
L.latLng(38.908429, -77.027191),
L.latLng(38.90857, -77.02277),
L.latLng(38.905658, -77.02227),
L.latLng(38.905612, -77.027192),
L.latLng(38.902529, -77.026221),
L.latLng(38.903827, -77.0284),
L.latLng(38.905883, -77.032461),
L.latLng(38.903656, -77.03174),
L.latLng(38.902705, -77.03574),
L.latLng(38.90206, -77.03852),
L.latLng(38.90276, -77.038519),
L.latLng(38.903738, -77.03485),
L.latLng(38.902, -77.033516),
L.latLng(38.89807, -77.031785),
L.latLng(38.894625, -77.031623),
L.latLng(38.89303, -77.026067),
L.latLng(38.89591, -77.025991),
L.latLng(38.89786, -77.027045),
L.latLng(38.898321, -77.02787),
L.latLng(38.900281, -77.029795),
L.latLng(38.89962, -77.031684),
L.latLng(38.8991, -77.03365),
L.latLng(38.89831, -77.03962),
L.latLng(38.898319, -77.04318),
L.latLng(38.895199, -77.043467),
L.latLng(38.896299, -77.044936),
L.latLng(38.894921, -77.046668),
L.latLng(38.894713, -77.045192),
L.latLng(38.893543, -77.04154),
L.latLng(38.899682, -77.041702),
L.latLng(38.900208, -77.0429),
L.latLng(38.9022, -77.043466),
L.latLng(38.90358, -77.044901),
L.latLng(38.903409, -77.043457),
L.latLng(38.90474, -77.041695),
L.latLng(38.90534, -77.046643),
L.latLng(38.90939, -77.048781),
L.latLng(38.9066, -77.051405),
L.latLng(38.901666, -77.050907),
L.latLng(38.90154, -77.046652),
L.latLng(38.900695, -77.047),
L.latLng(38.90088, -77.048822),
L.latLng(38.896076, -77.049879),
L.latLng(38.897282, -77.05557),
L.latLng(38.90373, -77.053537),
L.latLng(38.905129, -77.057021),
L.latLng(38.902221, -77.059111),
L.latLng(38.903749, -77.062777),
L.latLng(38.903282, -77.06589),
L.latLng(38.898999, -77.078341),
L.latLng(38.896062, -77.078116),
L.latLng(38.897653, -77.080734),
L.latLng(38.896859, -77.086392),
L.latLng(38.893236, -77.086112),
L.latLng(38.891733, -77.084522),
L.latLng(38.890608, -77.08486),
L.latLng(38.890509, -77.080995),
L.latLng(38.889326, -77.077398),
L.latLng(38.892136, -77.079439),
L.latLng(38.893477, -77.076402),
L.latLng(38.88992, -77.071315),
L.latLng(38.893843, -77.070804),
L.latLng(38.894606, -77.072237),
L.latLng(38.897324, -77.071006),
L.latLng(38.907741, -77.071611),
L.latLng(38.908429, -77.063589),
L.latLng(38.916394, -77.068295),
L.latLng(38.922549, -77.077271),
L.latLng(38.922604, -77.070396),
L.latLng(38.923537, -77.050057),
L.latLng(38.923178, -77.047643),
L.latLng(38.922883, -77.042588),
L.latLng(38.920696, -77.043772),
L.latLng(38.915314, -77.044525),
L.latLng(38.91881, -77.041667),
L.latLng(38.917815, -77.04062),
L.latLng(38.915512, -77.03818),
L.latLng(38.919083, -77.034493),
L.latLng(38.921071, -77.031872),
L.latLng(38.925285, -77.032295),
L.latLng(38.923358, -77.035243),
L.latLng(38.92609, -77.036474),
L.latLng(38.928874, -77.036294),
L.latLng(38.9319, -77.038858),
L.latLng(38.927903, -77.043337),
L.latLng(38.930323, -77.055469),
L.latLng(38.934335, -77.057796),
L.latLng(38.941007, -77.062026),
L.latLng(38.94455, -77.063774),
L.latLng(38.947121, -77.06523),
L.latLng(38.955061, -77.069844),
L.latLng(38.964903, -77.07595),
L.latLng(38.961347, -77.028003),
L.latLng(38.956482, -77.033052),
L.latLng(38.94777, -77.032778),
L.latLng(38.949738, -77.02733),
L.latLng(38.9565, -77.018041),
L.latLng(38.952448, -77.002724),
L.latLng(38.957358, -77.001911),
L.latLng(38.975055, -77.011208),
L.latLng(38.975182, -77.017008),
L.latLng(38.981194, -77.011358),
L.latLng(38.983558, -77.00626),
L.latLng(38.97801, -77.006479),
L.latLng(38.982647, -76.988234),
L.latLng(38.988023, -76.988428),
L.latLng(38.986776, -76.999957),
L.latLng(39.000523, -77.001503),
L.latLng(38.997455, -77.023885),
L.latLng(38.996997, -77.02564),
L.latLng(38.98972, -77.023843),
L.latLng(38.99081, -77.016284),
L.latLng(38.985398, -77.023055),
L.latLng(38.986996, -77.029416),
L.latLng(38.990242, -77.029364),
L.latLng(38.99268, -77.029343),
L.latLng(38.995206, -77.029176),
L.latLng(38.999405, -77.031536),
L.latLng(38.997695, -77.034542),
L.latLng(38.995667, -77.038732),
L.latLng(38.999687, -77.051176),
L.latLng(38.994109, -77.07695),
L.latLng(39.076375, -77.141322),
L.latLng(39.084369, -77.146886),
L.latLng(39.083672, -77.149024),
L.latLng(39.084059, -77.151288),
L.latLng(39.095684, -77.159002),
L.latLng(39.107714, -77.152213),
L.latLng(39.120012, -77.157132),
L.latLng(39.123531, -77.15737),
L.latLng(39.119746, -77.166072),
L.latLng(39.114694, -77.171496),
L.latLng(39.110326, -77.182676),
L.latLng(39.102139, -77.177294),
L.latLng(39.099401, -77.188024),
L.latLng(39.096284, -77.192686),
L.latLng(39.105247, -77.194794),
L.latLng(39.097581, -77.196672),
L.latLng(39.10309, -77.196439),
L.latLng(39.102104, -77.200335),
L.latLng(39.093781, -77.202608),
L.latLng(39.085376, -77.145801),
L.latLng(39.094846, -77.145221),
L.latLng(39.094031, -77.132901),
L.latLng(39.01476, -77.10711),
L.latLng(38.999638, -77.109559),
L.latLng(38.999511, -77.097808),
L.latLng(38.992418, -77.100107),
L.latLng(38.990612, -77.100268),
L.latLng(38.989496, -77.097955),
L.latLng(38.988592, -77.096591),
L.latLng(38.984713, -77.094298),
L.latLng(38.983459, -77.095367),
L.latLng(38.98389, -77.092222),
L.latLng(38.982454, -77.091988),
L.latLng(38.981102, -77.09738),
L.latLng(38.979979, -77.093454),
L.latLng(38.977092, -77.094626),
L.latLng(38.965, -77.103447),
L.latLng(38.961146, -77.088673),
L.latLng(38.961763, -77.085984),
L.latLng(38.95832, -77.084478),
L.latLng(38.954701, -77.082424),
L.latLng(38.949835, -77.080352),
L.latLng(38.947577, -77.079481),
L.latLng(38.946281, -77.08059),
L.latLng(38.94384, -77.077035),
L.latLng(38.934918, -77.07262),
L.latLng(38.938793, -77.087106),
L.latLng(38.970032, -77.338743),
L.latLng(38.970399, -77.34075),
L.latLng(38.960033, -77.35341),
L.latLng(38.960589, -77.356314),
L.latLng(38.962178, -77.358827),
L.latLng(38.962561, -77.361992),
L.latLng(38.95963, -77.35872),
L.latLng(38.957058, -77.35972),
L.latLng(38.955242, -77.368512),
L.latLng(38.955311, -77.357596),
L.latLng(38.955098, -77.35173),
L.latLng(38.948159, -77.338214),
L.latLng(38.92872, -77.240498),
L.latLng(38.923004, -77.227319),
L.latLng(38.923156, -77.232145),
L.latLng(38.92412, -77.236051),
L.latLng(38.928801, -77.225415),
L.latLng(38.932539, -77.231807),
L.latLng(38.931822, -77.219284),
L.latLng(38.924378, -77.217796),
L.latLng(38.920962, -77.221869),
L.latLng(38.919577, -77.221129),
L.latLng(38.915265, -77.220149),
L.latLng(38.884841, -77.156064),
L.latLng(38.880978, -77.13519),
L.latLng(38.884924, -77.1277),
L.latLng(38.876541, -77.127076),
L.latLng(38.878838, -77.120637),
L.latLng(38.880973, -77.111762),
L.latLng(38.883669, -77.113916),
L.latLng(38.883948, -77.1167),
L.latLng(38.898312, -77.118049),
L.latLng(38.896444, -77.104486),
L.latLng(38.895355, -77.097112),
L.latLng(38.894867, -77.091678),
L.latLng(38.895935, -77.088922),
L.latLng(38.890316, -77.088847),
L.latLng(38.884943, -77.087858),
L.latLng(38.884787, -77.093427),
L.latLng(38.888093, -77.09317),
L.latLng(38.888991, -77.092495),
L.latLng(38.887846, -77.095047),
L.latLng(38.885732, -77.097737),
L.latLng(38.884681, -77.101118),
L.latLng(38.882827, -77.103031),
L.latLng(38.881369, -77.103837),
L.latLng(38.883964, -77.107905),
L.latLng(38.882619, -77.109465),
L.latLng(38.879935, -77.107855),
L.latLng(38.876292, -77.107709),
L.latLng(38.876721, -77.113009),
L.latLng(38.87187, -77.107971),
L.latLng(38.869429, -77.10447),
L.latLng(38.869279, -77.095543),
L.latLng(38.880862, -77.091127),
L.latLng(38.880635, -77.08593),
L.latLng(38.873218, -77.082105),
L.latLng(38.87378, -77.089242),
L.latLng(38.866131, -77.087764),
L.latLng(38.86384, -77.080246),
L.latLng(38.86646, -77.076166),
L.latLng(38.860778, -77.095905),
L.latLng(38.856301, -77.111579),
L.latLng(38.85229, -77.105021),
L.latLng(38.854741, -77.100662),
L.latLng(38.84741, -77.095386),
L.latLng(38.857692, -77.086694),
L.latLng(38.862528, -77.086381),
L.latLng(38.867277, -77.072246),
L.latLng(38.862296, -77.059919),
L.latLng(38.85925, -77.06332),
L.latLng(38.863709, -77.063355),
L.latLng(38.862464, -77.068311),
L.latLng(38.846184, -77.069292),
L.latLng(38.847955, -77.075154),
L.latLng(38.848491, -77.084807),
L.latLng(38.844407, -77.085928),
L.latLng(38.842305, -77.089571),
L.latLng(38.839891, -77.087039),
L.latLng(38.837609, -77.094789),
L.latLng(38.833993, -77.087188),
L.latLng(38.828442, -77.08611),
L.latLng(38.820094, -77.062826),
L.latLng(38.812678, -77.061772),
L.latLng(38.807027, -77.059872),
L.latLng(38.805811, -77.060742),
L.latLng(38.804424, -77.06086),
L.latLng(38.802601, -77.063572),
L.latLng(38.801129, -77.068948),
L.latLng(38.79765, -77.053751),
L.latLng(38.80561, -77.052909),
L.latLng(38.805315, -77.049836),
L.latLng(38.79822, -77.048682),
L.latLng(38.79928, -77.044777),
L.latLng(38.803089, -77.040366),
L.latLng(38.804796, -77.043346),
L.latLng(38.812439, -77.040671),
L.latLng(38.812727, -77.044151),
L.latLng(38.81073, -77.044583),
L.latLng(38.811439, -77.050116),
L.latLng(38.813556, -77.049456),
L.latLng(38.818735, -77.047825),
L.latLng(38.821752, -77.047459),
L.latLng(38.814528, -77.052848),
L.latLng(38.820069, -77.057538),
L.latLng(38.82097, -77.053105),
L.latLng(38.822757, -77.049274),
L.latLng(38.82955, -77.047893),
L.latLng(38.825941, -77.058616),
L.latLng(38.833069, -77.059912),
L.latLng(38.841313, -77.0631),
L.latLng(38.843346, -77.063991),
L.latLng(38.842588, -77.050257),
L.latLng(38.844032, -77.050471),
L.latLng(38.848416, -77.051448),
L.latLng(38.853524, -77.053419),
L.latLng(38.85059, -77.051572),
L.latLng(38.853206, -77.049811),
L.latLng(38.856433, -77.049326),
L.latLng(38.857398, -77.051037),
L.latLng(38.857884, -77.059474),
L.latLng(38.857325, -77.053335),
Out[66]:
[<matplotlib.lines.Line2D at 0x2351e26fa20>]

In [23]:
result['waypoints']


Out[23]:
[{'hint': '01oNgP-MDoDk6wMABQAAAOEAAACLAQAAAAAAAAUAAADhAAAAiwEAAAAAAADk5wcAWgAAAGJCaPvM8FAC0kJo-9rwUAIGAAICxto8gA==',
  'location': [-77.053342, 38.858956],
  'name': 'South Eads Street',
  'trips_index': 0,
  'waypoint_index': 0},
 {'hint': '0loNgBwhFYAA7QEAMwAAAKMAAAAAAAAAGQAAADMAAACjAAAAAAAAABkAAADj5wcAWgAAAGlCaPtt6lACeEJo-yLqUAIAAAYCxto8gA==',
  'location': [-77.053335, 38.857325],
  'name': '18th Street South',
  'trips_index': 0,
  'waypoint_index': 1},
 {'hint': 'RkAGgEhABoAQ8gMA8QAAAFIAAAA8AAAAAAAAAPEAAABSAAAAPAAAAAAAAAAM3AMAWgAAABJSaPvx5lACclJo--7mUAIBAAICxto8gA==',
  'location': [-77.049326, 38.856433],
  'name': 'South Crystal Drive',
  'trips_index': 0,
  'waypoint_index': 3},
 {'hint': 'CI0OgMLlDoBU6wEAVQAAAD0AAABqAQAAAAAAAFUAAAA9AAAAagEAAAAAAADzgQgAWgAAAA5RaPsx9VACClFo-4r1UAICAAYCxto8gA==',
  'location': [-77.049586, 38.860081],
  'name': '15th Street South',
  'trips_index': 0,
  'waypoint_index': 49},
 {'hint': 'rqgMgNSoDIAAAAAABAAAAC4AAAAAAAAAAAAAAAQAAAAuAAAAAAAAAAAAAABXiQcAWgAAAG4qaPuc7FACXipo-47sUAIAAAYGxto8gA==',
  'location': [-77.059474, 38.857884],
  'name': '',
  'trips_index': 0,
  'waypoint_index': 9},
 {'hint': 'SaYMgHGmDIAAAAAAxgAAAFYAAAA0AQAA0AMAAMYAAABWAAAANAEAANADAADshwcAWgAAALEoaPvY_VACnCho-9z9UAIDAAYGxto8gA==',
  'location': [-77.059919, 38.862296],
  'name': '',
  'trips_index': 0,
  'waypoint_index': 10},
 {'hint': '96UMgPylDIAAAAAABgEAABAAAAAAAAAAcwQAAAYBAAAQAAAAAAAAAHMEAAC7hwcAWgAAAEUbaPtdA1ECfBto-1QDUQIAAAYGxto8gA==',
  'location': [-77.063355, 38.863709],
  'name': '',
  'trips_index': 0,
  'waypoint_index': 12},
 {'hint': 'bTkGgA2NDoBw5AMALAAAAAUAAAAYAQAAQgAAACwAAAAFAAAAGAEAAEIAAADg1gMAWgAAAGNLaPu26lACBkto-7jqUAICAAICxto8gA==',
  'location': [-77.051037, 38.857398],
  'name': 'South Bell Street',
  'trips_index': 0,
  'waypoint_index': 2},
 {'hint': 'oTgGgMpUBoDk8AEAugAAAA0BAAAAAAAAJwAAALoAAAANAQAAAAAAACcAAAAv1gMAWgAAAIdEaPuCAFECgERo-zQAUQIAAAICxto8gA==',
  'location': [-77.052793, 38.862978],
  'name': '12th Street South',
  'trips_index': 0,
  'waypoint_index': 11},
 {'hint': 'ZOASgI7GFYBwXQQABQAAAGwAAAAOAAAAQgEAAAUAAABsAAAADgAAAEIBAADFawoAWgAAAMhJaPugx1ACgElo-7jHUAIBAAIGxto8gA==',
  'location': [-77.051448, 38.848416],
  'name': 'Crystal Drive',
  'trips_index': 0,
  'waypoint_index': 5},
 {'hint': 'YOASgFl1E4AwXQQADAAAABEAAAAeAAAAHgEAAAwAAAARAAAAHgAAAB4BAADDawoAWgAAAG9OaPvcsFACqE5o--iwUAIBAAICxto8gA==',
  'location': [-77.050257, 38.842588],
  'name': 'Potomac Yard Trail',
  'trips_index': 0,
  'waypoint_index': 6},
 {'hint': 'TkAGgAWlGoC87gEAiwAAAGIAAAAAAAAAAAAAAIsAAABiAAAAAAAAAAAAAAAT3AMAWgAAAC1QaPtW2lACOFBo-7TaUAIAAAYCxto8gA==',
  'location': [-77.049811, 38.853206],
  'name': '23rd Street South',
  'trips_index': 0,
  'waypoint_index': 4},
 {'hint': 'T0AGgOdGBoAg7AEA8AAAAC4AAAAAAAAAAAAAAPAAAAAuAAAAAAAAAAAAAAAU3AMAWgAAAExJaPse0FACgElo-4LQUAIAAAICxto8gA==',
  'location': [-77.051572, 38.85059],
  'name': '26th Street South',
  'trips_index': 0,
  'waypoint_index': 7},
 {'hint': 'LlMNgO1FEIAcaQEAxAAAAFcAAAAAAAAAHwAAAMQAAABXAAAAAAAAAB8AAACK4wcAWgAAACxraPvwkVECLGto-0ySUQIAAAYCxto8gA==',
  'location': [-77.0429, 38.900208],
  'name': 'H Street Northwest',
  'trips_index': 0,
  'waypoint_index': 14},
 {'hint': 'QygegFUoHoBoYwEAdgAAAH8AAAAAAAAAAAAAAHYAAAB_AAAAAAAAAAAAAABHHg8AWgAAAPCVaPvg1VECXJVo--DVUQIAAAICxto8gA==',
  'location': [-77.031952, 38.9176],
  'name': '14th Street Northwest',
  'trips_index': 0,
  'waypoint_index': 20},
 {'hint': 'ztQcgNHUHIAAAAAAJQAAAL0AAAAAAAAAAAAAACUAAAC9AAAAAAAAAAAAAACqnQ4AWgAAAGGmaPs_BFICFKZo-zQEUgIAAAICxto8gA==',
  'location': [-77.027743, 38.929471],
  'name': '',
  'trips_index': 0,
  'waypoint_index': 35},
 {'hint': 'HYoEgJa6HICQcgEANwAAAB8AAAAAAAAAAAAAADcAAAAfAAAAAAAAAAAAAABW4gIAWgAAAEaEaPsK91ECBIRo-wr3UQIAAAICxto8gA==',
  'location': [-77.036474, 38.92609],
  'name': '16th Street Northwest',
  'trips_index': 0,
  'waypoint_index': 30},
 {'hint': 'Cu4ZgA7uGYAAAAAABgAAABcAAAAgAAAAAAAAAAYAAAAXAAAAIAAAAAAAAAANdA0AWgAAAGRsaPuD6lECbGxo-7LqUQIBAAYGxto8gA==',
  'location': [-77.042588, 38.922883],
  'name': '',
  'trips_index': 0,
  'waypoint_index': 26},
 {'hint': 'CIoEgG3THIAAAAAANQAAAAAAAAAAAAAATAAAADUAAAAAAAAAAAAAAEwAAABH4gIAWgAAAIWUaPtw-VEC-JRo-9D5UQIAAAYGxto8gA==',
  'location': [-77.032315, 38.926704],
  'name': '',
  'trips_index': 0,
  'waypoint_index': 31},
 {'hint': 'OjobgEM6G4AAAAAALwAAAF4FAAAqAAAAwQAAAC8AAABeBQAAKgAAAMEAAACV9Q0AWgAAAKVYaPuq61ECqFho-8DrUQIBAAYGxto8gA==',
  'location': [-77.047643, 38.923178],
  'name': '',
  'trips_index': 0,
  'waypoint_index': 27},
 {'hint': 'd6wcgCm1HIDcZwEAJgAAAHMAAABUAAAAAAAAACYAAABzAAAAVAAAAAAAAACXjg4AWgAAAPZ6aPu8DVICMHto-7wNUgIBAAIGxto8gA==',
  'location': [-77.038858, 38.9319],
  'name': '17th Street Northwest',
  'trips_index': 0,
  'waypoint_index': 29},
 {'hint': 'p2sNgADBGIAUaQEAEAAAABkAAAAfAAAARwAAABAAAAAZAAAAHwAAAEcAAADW8AcAWgAAAJnNaPssNlECOM1o-xw2UQIBAAICxto8gA==',
  'location': [-77.017703, 38.876716],
  'name': '4th Street Southwest',
  'trips_index': 0,
  'waypoint_index': 48},
 {'hint': 'I14EgCVeBIDAZgEAMgAAABABAAAAAAAAVgAAADIAAAAQAQAAAAAAAFYAAACDwwIAWgAAAMOLaPuat1ECOIxo-5q3UQIAAAIGxto8gA==',
  'location': [-77.034557, 38.90985],
  'name': '15th Street Northwest',
  'trips_index': 0,
  'waypoint_index': 23},
 {'hint': 'NsUZgPGwHIAAAAAAaQAAADcAAAAAAAAAAAAAAGkAAAA3AAAAAAAAAAAAAAAUYw0AWgAAAACXaPt6wlECAJdo-6jCUQIAAAIGxto8gA==',
  'location': [-77.03168, 38.912634],
  'name': '',
  'trips_index': 0,
  'waypoint_index': 21},
 {'hint': 'PYoTgA8tGICcaAEAYAEAADgAAAAAAAAAAAAAAGABAAA4AAAAAAAAAAAAAACcsgoAWgAAAF2UaPsZs1EClJRo-7iyUQIAAAICxto8gA==',
  'location': [-77.032355, 38.908697],
  'name': 'Rhode Island Avenue Northwest',
  'trips_index': 0,
  'waypoint_index': 22},
 {'hint': 'Zk4NgKAgHoAQbAEAOgAAAIkCAAAcAAAAAAAAADoAAACJAgAAHAAAAAAAAAAG4QcAWgAAADhjaPurglEC-GJo-6yCUQICAAIGxto8gA==',
  'location': [-77.044936, 38.896299],
  'name': '20th Street Northwest',
  'trips_index': 0,
  'waypoint_index': 16},
 {'hint': '8kYEgCx4BICQawEARwAAAGUAAAAAAAAAZQAAAEcAAABlAAAAAAAAAGUAAAB1sQIAWgAAAChbaPvXk1ECKFto-0CUUQIAAAICxto8gA==',
  'location': [-77.047, 38.900695],
  'name': 'I Street Northwest',
  'trips_index': 0,
  'waypoint_index': 13},
 {'hint': 'bV8EgHFfBICIYQEAogIAACcAAAAAAAAAQwAAAKICAAAnAAAAAAAAAEMAAAB8xAIAWgAAAK-yaPvPHVICdrJo--gdUgIAAAYCxto8gA==',
  'location': [-77.024593, 38.936015],
  'name': 'New Hampshire Avenue Northwest',
  'trips_index': 0,
  'waypoint_index': 34},
 {'hint': 'obodgKy6HYAAAAAAUgAAACsAAAAAAAAAMAAAAFIAAAArAAAAAAAAADAAAAAA9w4AWgAAALeSaPucI1ICoJJo-5wjUgIAAAICxto8gA==',
  'location': [-77.032777, 38.9375],
  'name': '',
  'trips_index': 0,
  'waypoint_index': 33},
 {'hint': '_QkPgL6eF4AoeAEAEQAAAI4AAAAiAAAAmAAAABEAAACOAAAAIgAAAJgAAAALuwgAWgAAAPYjafs9GFICVCRp-0gYUgIBAAICxto8gA==',
  'location': [-76.995594, 38.934589],
  'name': 'John McCormack Road',
  'trips_index': 0,
  'waypoint_index': 37},
 {'hint': 'XuYMgNEsGIAAAAAA0QAAAHYAAABqAQAAxQAAANEAAAB2AAAAagEAAMUAAAC8qQcAWgAAAEHIaPsAnVECasho-wCdUQINAAICxto8gA==',
  'location': [-77.019071, 38.90304],
  'name': '',
  'trips_index': 0,
  'waypoint_index': 17},
 {'hint': 'xD4EgMk-BIDoZQEAEwAAABcAAAA9AAAAtAAAABMAAAAXAAAAPQAAALQAAAC_qgIAWgAAAAxtafv4aFEC_Gxp-4BoUQICAAIGxto8gA==',
  'location': [-76.976884, 38.88972],
  'name': 'East Capitol Street Southeast',
  'trips_index': 0,
  'waypoint_index': 39},
 {'hint': 'BJgEgLveEoAUdQEAhAAAANkAAAAAAAAAAAAAAIQAAADZAAAAAAAAAAAAAAAZ6gIAWgAAAN-XaPskCVICtJdo-3AJUgIAAAICxto8gA==',
  'location': [-77.031457, 38.930724],
  'name': 'Park Road Northwest',
  'trips_index': 0,
  'waypoint_index': 32},
 {'hint': 'MEkEgHVQBIAYZAEAMQAAAEgAAAAAAAAAfwAAADEAAABIAAAAAAAAAH8AAAAtswIAWgAAALaSafvV9FAC4JJp-0T1UAIAAAICxto8gA==',
  'location': [-76.967242, 38.859989],
  'name': 'Good Hope Road Southeast',
  'trips_index': 0,
  'waypoint_index': 43},
 {'hint': 'HVIEgBKABICQYAEAGwAAAFIAAAAvAAAAFwEAABsAAABSAAAALwAAABcBAABkugIAWgAAAPwwaPs_F1ICRDBo-_4WUgIBAAICxto8gA==',
  'location': [-77.057796, 38.934335],
  'name': 'Connecticut Avenue Northwest',
  'trips_index': 0,
  'waypoint_index': 28},
 {'hint': 'y34EgP___38IbQEAEgAAAB0AAAAdAAAAOgAAABIAAAAdAAAAHQAAADoAAACuqwIAWgAAAMqraftAO1ECRKxp-zA7UQIBAAICxto8gA==',
  'location': [-76.960822, 38.878016],
  'name': 'Randle Circle Southeast',
  'trips_index': 0,
  'waypoint_index': 42},
 {'hint': 'AXgRgGeTGYAAAAAASAAAAJgAAAAVAgAAsgAAAEgAAACYAAAAFQIAALIAAACgzAkAWgAAAB7gafuYhVECBuBp-6SFUQIDAAYGxto8gA==',
  'location': [-76.947426, 38.897048],
  'name': '',
  'trips_index': 0,
  'waypoint_index': 41},
 {'hint': 'DngRgJzsG4AAAAAAMAAAAAkAAAA-AAAAFwAAADAAAAAJAAAAPgAAABcAAACjzAkAWgAAAGb1afv2llECyPVp-4SWUQIBAAICxto8gA==',
  'location': [-76.941978, 38.901494],
  'name': '',
  'trips_index': 0,
  'waypoint_index': 40},
 {'hint': 'qgAOgKsADoBscgEAEQAAADcAAACYAQAAAAAAABEAAAA3AAAAmAEAAAAAAAA2PQgAWgAAAMMnafss_1ACsCdp-07_UAICAAICxto8gA==',
  'location': [-76.994621, 38.862636],
  'name': 'Shannon Place Southeast',
  'trips_index': 0,
  'waypoint_index': 45},
 {'hint': 'SlAEgBdYDYAYZAEACwAAANsAAABvAAAAAAAAAAsAAADbAAAAbwAAAAAAAAD8uAIAWgAAAGhBaft5EVECeEFp-6oRUQIBAAICxto8gA==',
  'location': [-76.988056, 38.867321],
  'name': 'Good Hope Road Southeast',
  'trips_index': 0,
  'waypoint_index': 44},
 {'hint': 'QVEEgBRvBIDgbQEAUwQAADMAAAAAAAAAAAAAAFMEAAAzAAAAAAAAAAAAAAC8uQIAWgAAAPVoaPtfflECcGho-2B-UQIAAAYCxto8gA==',
  'location': [-77.043467, 38.895199],
  'name': '19th Street Northwest',
  'trips_index': 0,
  'waypoint_index': 15},
 {'hint': 'TUYEgFFGBIDgYQEAAwEAABoAAAAAAAAAAAAAAAMBAAAaAAAAAAAAAAAAAADvsAIAWgAAAIgQafuo21ECNhBp-6jbUQIAAAICxto8gA==',
  'location': [-77.000568, 38.91908],
  'name': '4th Street Northeast',
  'trips_index': 0,
  'waypoint_index': 38},
 {'hint': 'fpMEgGHIDoAIcwEA8gAAADYAAAAAAAAAAAAAAPIAAAA2AAAAAAAAAAAAAACK5wIAWgAAADataPtQ1FEClK1o-1DUUQIAAAICxto8gA==',
  'location': [-77.025994, 38.9172],
  'name': '10th Street Northwest',
  'trips_index': 0,
  'waypoint_index': 19},
 {'hint': 'VnIEgFhyBIB0agEAOQAAAJAAAABaAAAATAAAADkAAACQAAAAWgAAAEwAAACG0gIAWgAAABC8aPsv8lECCLxo-2TyUQIBAAIGxto8gA==',
  'location': [-77.022192, 38.924847],
  'name': 'Fairmont Street Northwest',
  'trips_index': 0,
  'waypoint_index': 36},
 {'hint': 'EmwNgCzCGYA4FAQALwAAAHYCAAAQAgAAJgAAAC8AAAB2AgAAEAIAACYAAAAN8QcAWgAAABH8aPu7LFECfPxo-7wsUQIDAAICxto8gA==',
  'location': [-77.005807, 38.874299],
  'name': 'Anacostia Waterfront Trail',
  'trips_index': 0,
  'waypoint_index': 46},
 {'hint': '53YEgLBODYAgdwEAJgAAABcAAABLAAAAPgAAACYAAAAXAAAASwAAAD4AAAC11QIAWgAAANNkaPvyzFECiGRo-0jNUQIBAAICxto8gA==',
  'location': [-77.044525, 38.915314],
  'name': 'Florida Avenue Northwest',
  'trips_index': 0,
  'waypoint_index': 25},
 {'hint': '2WYEgJWbEIAsawEAOQAAAJwAAAAAAAAAAAAAADkAAACcAAAAAAAAAAAAAAAcygIAWgAAAAi8aPvzzVECCLxo-6zNUQIAAAYCxto8gA==',
  'location': [-77.0222, 38.915571],
  'name': 'T Street Northwest',
  'trips_index': 0,
  'waypoint_index': 18},
 {'hint': '71MGgDEhFYDk6wMAKgAAAFsAAAAAAAAAAAAAACoAAABbAAAAAAAAAAAAAABk6AMAWgAAABVCaPuU21ACukFo-5rbUAIAAAICxto8gA==',
  'location': [-77.053419, 38.853524],
  'name': 'South Eads Street',
  'trips_index': 0,
  'waypoint_index': 8},
 {'hint': 'FGwNgAjCDYAUdwEAVgAAAFwAAAAAAAAAAAAAAFYAAABcAAAAAAAAAAAAAAAO8QcAWgAAAE0EafsWNVECTARp-4w0UQIAAAYCxto8gA==',
  'location': [-77.003699, 38.876438],
  'name': 'M Street Southeast',
  'trips_index': 0,
  'waypoint_index': 47},
 {'hint': 'N3gPgEx4D4CMbAEACAAAABQAAAAAAAAAEgAAAAgAAAAUAAAAAAAAABIAAAAS7ggAWgAAADBlaPsnuFECUGVo-5S4UQIAAAYCxto8gA==',
  'location': [-77.044432, 38.909991],
  'name': 'Massachusetts Avenue Northwest',
  'trips_index': 0,
  'waypoint_index': 24}]

Exploring basic statistics


In [2]:
data = pd.read_csv('stations.csv')

In [6]:
data['nbBikes'].sum()


Out[6]:
3141

In [24]:
trips = pd.concat([pd.read_csv('2016-Q3-cabi-trips-history-data/2016-Q3-Trips-History-Data-1.csv', infer_datetime_format=True, parse_dates=['Start date', 'End date']),
                  pd.read_csv('2016-Q3-cabi-trips-history-data/2016-Q3-Trips-History-Data-2.csv', infer_datetime_format=True, parse_dates=['Start date', 'End date'])])

In [26]:
trips = trips.sort_values(by='Start date')

In [27]:
trips['Start date'].max() - trips['Start date'].min()


Out[27]:
Timedelta('91 days 23:59:00')

In [28]:
trips.head()


Out[28]:
Duration (ms) Start date End date Start station number Start station End station number End station Bike number Member Type
723739 430365 2016-07-01 00:00:00 2016-07-01 00:07:00 31023 Fairfax Dr & Wilson Blvd 31025 Central Library / N Quincy St & 10th St N W20623 Casual
723740 696813 2016-07-01 00:00:00 2016-07-01 00:12:00 31620 5th & F St NW 31628 1st & K St SE W00777 Registered
723738 623359 2016-07-01 00:00:00 2016-07-01 00:10:00 31105 14th & Harvard St NW 31105 14th & Harvard St NW W20029 Registered
723736 456086 2016-07-01 00:01:00 2016-07-01 00:08:00 31202 14th & R St NW 31234 20th & O St NW / Dupont South W00068 Registered
723737 1099427 2016-07-01 00:01:00 2016-07-01 00:19:00 31268 12th & U St NW 31506 1st & Rhode Island Ave NW W20726 Registered

In [35]:
trips['Bike number'].unique().size


Out[35]:
4095

In [33]:
len(trips) / 92


Out[33]:
11608.554347826086