Skip to main content

A package for analysing public transport data

Project description

Python module for the analysis of public busses in Warsaw, Poland

A Python module that analyzes publicly available data on public busses in Warsaw, Poland. The data is available at the Warsaw Public Transport Authority. The project's goals are to: (1) visualize where the busses exceed the speed of 50 km/h, (2) analyze the punctuality of the busses as well as evaluate in which districts do the busses tends to be late, and (3) analyze whether there is a correlation between busses exceeding the speed of 50 km/h and them speeding in the vicinity of theaters.

Installation

pip install bus_project_NJ

Documentation

collect_all_data(api_key, data_set_size: int = 60, spacing: int = 60) -> None - Collects all the data from the API (ie. the bus schedules, bus routes, bus stops, the positions of theaters in Warsaw and the current positions of the busses) and saves it in appropriate directories.

collect_bus_routes(api_key: str, path: str = 'bus_data') -> None - Collects the bus routes and saves them in the "bus_routes" directory.

collect_bus_schedules(apikey: str, path: str = 'bus_data') -> None - Collects the bus schedules and saves them in the "bus_data/bus_lines" directory. The path parameter is used to determine the directory in which to save the data.

fetch_bus_stops(apikey: str, path: str = 'bus_data') -> None - Fetches the bus stops and saves them in the "bus_data/bus_stops" directory. The path parameter is used to determine the directory in which to save the data.

fetch_current_positions(api_key: str, iterations: int, spacing: int = 10, path: str = 'data_sets') -> None - Fetches the current positions of the busses and saves them in the "data_sets" directory. The path parameter is used to determine the directory in which to save the data.

fetch_theaters(api_key: str, path: str = 'theaters_data') -> None - Fetches the positions of theaters in Warsaw and saves them in the "theaters_data" directory.

analyze_all(data_set: int, streets: bool = False) -> None - analyzes all the data collected and saves the plots in the "plots" directory. The streets parameter is used to determine whether to analyze the data in the context of streets as well as districts (by default only districts are analyzed).

calculate_total_lateness(data_set: int, path: str = 'lateness_data') -> None - transforms the data into a format that allows for the calculation of the total delays of the busses in Warsaw. The path parameter is used to determine the directory in which to save the data.

filter_data_set(data_set: int, streets: bool = False radius: int = 700, path: str = 'filtered_data') -> None - filters the data set into a more friendly format for the analysis. If the streets parameter is set to True, the data is filtered to include the streets at which the busses sent out data by sending a request to the GUGiK API. The radius parameter is used to determine the radius around the positions in which to look for streets. The path parameter is used to determine the directory in which to save the data.

plot_theaters_map(data_set: int, theaters_path: str = 'theaters_data', destination: str = 'plots',dump: bool = False, dump_path: str = '', filtered_path: str = 'filtered_data') -> None - plots the positions of the theaters in Warsaw and the positions of the busses that exceed the speed of 50 km/h. The theaters_path parameter is used to determine the directory in which the theaters data is saved. The destination parameter is used to determine the directory in which to save the plots. The dump parameter is used to determine whether to save the data in a file. The dump_path parameter is used to determine the directory in which to save the dumped data. The filtered_path parameter is used to determine the directory in which the filtered data is located.

plot_street_percentage(data_set: int, number: int = 10, src_path: str = 'filtered_data', dst_path: str = 'plots') -> None - plots the percentage of infractions that happened on the top {number} streets in a bar chart.

plot_district_percentage(data_set: int, dst_path: = 'plots') -> None - plots the percentage of infractions that happened in each district in a bar chart.

plot_percentage_per_district(data_set: int, path: str = 'plots') - plots the percentage of infractions that happened in each district as a part of the total number of infractions in a pie chart.

plot_number_of_infractions(data_set: int, path: str = 'plots') -> None - plots the number of infractions that happened in each district.

draw_map(data_set: int, path: str = 'plots') -> None - draws a map of Warsaw with the speeding busses and alongside the percentage of infractions in each district. Red lines represent the places where the busses were speeding.

plot_lateness(data_set: int, src_path: str = 'lateness_data', dst_path: str = 'plots') - Plots the number of minutes late for all of Warsaw and all of Warsaw's districts.

plot_speed_versus_delays(data_set: int, path: str = 'plots') -> None - Plots the relationship between a vehicle going over the speed limit and them being on time.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bus_project_NJ-0.0.2.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bus_project_NJ-0.0.2-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file bus_project_NJ-0.0.2.tar.gz.

File metadata

  • Download URL: bus_project_NJ-0.0.2.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/7.0.1 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for bus_project_NJ-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c2786805ada7a6d686493fc0ff0eb4cfa0a735f4f9dbfc0cec40a7d001233bd8
MD5 f058c0226eab3499ad8aadf920c3d583
BLAKE2b-256 9134801798a4ec7bee3eca4720d7f76e2bf35202c1470036ec71e11d673aca29

See more details on using hashes here.

File details

Details for the file bus_project_NJ-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: bus_project_NJ-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/7.0.1 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for bus_project_NJ-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fe7a666602646086013f67c66cea7ed51f8d5c8435a5b7256a02fdfa7fe30dae
MD5 8307998225458b3ad8b1d57ac66d4244
BLAKE2b-256 c92ca6c3ce74047f4dc6a4302a82d76bfe0457f502c73de628b18fad694be7d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page