Free Bicycle (Velib, …)

manydataapi.velib.DataCollectJCDecaux (self, apiKey, fetch_contracts = False)

This class automates data collecting from JCDecaux. The service is provided at JCDecaux developer.

See also notebook on Velib The list of contracts for JCDecaux can be obtained at: Données statiques. The API provided by JCDecaux is described here.

animation (df, interval = 20, module = ‘matplotlib’, args)

Displays a javascript animation, see animation.FuncAnimation.

collecting_data (self, contract, delayms = 1000, outfile = ‘velib_data.txt’, single_file = True, stop_datetime = None, log_every = 10, fLOG = <built-in function print>)

Collects data for a period of time.

distance_haversine (lat1, lon1, lat2, lon2)

Computes the haversine distance.

draw (df, use_folium = False, args)

Draws a graph using four columns: lng, lat, available_bike_stands, available_bikes.

get_contracts (self)

Returns the list of contracts.

get_json (self, contract)

Returns the data associated to a contract.

run_collection (key = None, contract = ‘Paris’, delayms = 60000, folder_file = ‘velib_data’, stop_datetime = None, single_file = False, log_every = 1, fLOG = <built-in function print>)

Runs the collection of the data for velib, data are stored using json format. The function creates a file every time a new status is downloaded.

simulate (df, nbbike, speed, period = 0:01:00, iteration = 500, min_min = 10, delta_speed = 2.5, fLOG = <built-in function print>)

Simulates velibs on a set of stations given by df.

to_df (folder, regex = ‘velib_data.*[.]txt’)

Reads all files in a folder (assuming there were produced by this class) and returns a dataframe with it.