Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Ternhaven/shouldIdriveornot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

drive-or-bike

Information about gasoline and electricity prices in Sweden

How to use

Quick Use - script.py

Simply call python script.py to quickly scrape the websites and create a plot, circleplot.png.

notebook.ipynb

The two scraper functions, electricity_price and gasoline_price each return a number: the current price of electricity (Swedish Krona [SEK] per kilowatt-hour [kWh]) and gasoline (SEK/Liter), respectively.

If we have that

elec_price = electricity_price()
gas_price = gasoline_price()

The total cost (in SEK) of a trip of x kilometers can then be calculated:

electricity_cost_sek(x, elec_price)  # (For an ebike)
gasoline_cost_sek(x, gas_price)   # (For a car)

The function electricity_cost_sek assumes a default value of 100 kilometers per kWh efficiency; likewise, gasoline_cost_sek assumes a default value of 9.4 kilometers per liter efficiency. Each of these functions can take a third argument if you would like to set either efficiency to a different value, i.e. electricity_cost_sek(x, elec_price, 80.0).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published