Skip to content

Compute age of public transportation in Russian cities

License

Notifications You must be signed in to change notification settings

shoorick/tram-age

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compute age of trams in Russian cities

The most of systems of public transportation in Russia uses ancient wagons. List of passenger vehicles by particular city is available at URL like https://transphoto.org/list.php?serv=0&cid=54&t=1, list of Russian cities available at https://transphoto.org/country/1/

This program fetches data for specified city and type of transportation and then make some statistical computation.

Preparing

make prepare
. env/bin/activate

or

sudo apt install pip3-venv
python3 -m venv env
. env/bin/activate
pip install -r requirements.txt

Usage

compute.py [-h] [-c CITY] [-t TYPE] [-l LANGUAGE]

Optional arguments

  • -h, --help — show help message and exit
  • -c CITY, --city CITY — number or name (default city is Moscow)
  • -t TYPE, --type TYPE — transportation type (digit 1 to 9 or name, default value is tram)
  • -l CODE, --language CODEISO 639-1 language code (default is ru for Russian)
  • -o FILE, --output FILE — output frequency table to file. Format detected by filename without case sensitivity.

File formats

  • CSV — Comma Separated Values — file.csv
  • HTML — Hypertext Markup Language — file.htm, file.html
  • JSON — JavaScript Notation Object — file.json, file.js
  • Microsoft Excel — file.xls (legacy), file.xlsx

Examples

It's possible to use digital IDs

$ python compute.py --city 229 --type 2
Миасс, троллейбус
-----------------
1987       1 #
1988       3 ###
1989       1 #
1992       2 ##
1993       2 ##
2002       2 ##
2004       1 #
2005       1 #
2006       1 #
2007       1 #
2008       3 ###
2009       6 ######
2011       1 #
2020       2 ##
------------
Total     28
Mean: 2002.6, median: 2006.5, modes: [2009]

or human readable names

$ python compute.py --city Ekb --type metro --language en
Yekaterinburg, metro
--------------------
1988       6 ######
1989      39 #######################################
2011       8 ########
2019       8 ########
------------
Total     61
Mean: 1995.7, median: 1989.0, modes: [1989]

Names can be specified in English or in Russian. There are aliases for cities and types for example:

  • metro = metropolitain = subway = underground
  • tramway = tram = tm
  • SPb = Saint Petersburg = Petersburg

See also

Author

Alexander Sapozhnikov http://shoorick.ru/ shoorick@cpan.org

About

Compute age of public transportation in Russian cities

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published