Where is the cheapest petrol?

by Stubborn Mule on 1 January 2012 · 3 comments

For some time now, I have been meaning to have a look at Beautiful Soup, a python library designed to make it easy to scrape data from web-sites. Now that I have finally tried it out, I wish I had got to it sooner. It really is very handy and easy to use.

As my first Soup project, I turned to an old Mule favourite: petrol data. The Australian Institute of Petroleum (AIP) publishes retail petrol price data, which it sources in turn from MotorMouth. The price data is spread across individual pages for each state, like this one for Victoria and there are separate pages for unleaded and diesel. It would be nice to pull together all of the data and, since the pages are all laid out in exactly the same way and there is a straightforward naming convention for the urls of each page, this is very easy to do using Beautiful Soup. You can see the results showing average weekly petrol prices for the week ending 18 December in the table below.

With all the data in hand, the obvious questions to ask are: where is the cheapest petrol and where is the most expensive petrol? As you can see in the chart below, Adelaide came in as the cheapest place to fill your tank in late December at 134.9 cent/L, while Broome was the most expensive at 165.9, an impressive 23% mark up over Adelaide.

Australian Petrol PricesTop 10 and bottom 10 unleaded petrol prices
(average for the week ending 18 December 2011)

Of course this only gives a snapshot at a point in time: Adelaide may not always offer such good value for money and Broome residents may not always pay such a premium. Unfortunately, I have not been able to find any historical data by town on the AIP website. So I have set my data-scraping routine up to collect the data each week. Some time late this year I will revisit this data to see if any patterns emerge over time.

StateTownWeekly Average
NSWAlbury135.5
NSWArmidale143.6
NSWBallina146.9
NSWBatemans Bay144.3
NSWBathurst145.9
NSWBega150.1
NSWBroken Hill145.9
NSWBulahdelah138.1
NSWBuronga146
NSWCanberra146.4
NSWCasino144.8
NSWCentral Coast143.2
NSWCoffs Harbour147
NSWCooma150.3
NSWCootamundra149.2
NSWDeniliquin148.9
NSWDubbo143.1
NSWForbes147.5
NSWForster146.9
NSWGlen Innes141.9
NSWGoulburn141.9
NSWGrafton146.3
NSWGriffith144.4
NSWGundagai141.7
NSWGunnedah144
NSWHay145.8
NSWInverell146.9
NSWKempsey146.2
NSWLeeton145.5
NSWLismore144.5
NSWLithgow139.9
NSWMittagong149.9
NSWMoama145.9
NSWMoree148.8
NSWMoruya147.6
NSWMoss Vale142.1
NSWMudgee150.4
NSWMurwillumbah143.1
NSWMuswellbrook146.6
NSWNewcastle144.3
NSWNowra144.8
NSWOrange147.4
NSWParkes146.7
NSWPort Macquarie146.5
NSWQueanbeyan146.6
NSWSingleton143.8
NSWSydney138.2
NSWTamworth145.7
NSWTaree144.9
NSWTemora148
NSWTumut145.9
NSWTweed Heads South141
NSWUlladulla143.9
NSWWagga Wagga144.9
NSWWauchope143.6
NSWWest Wyalong149.9
NSWWollongong143
NSWWoolgoolga145.7
NSWYass148.4
NTAlice Springs163.4
NTDarwin151.8
NTKatherine146.3
NTTennant Creek164
QLDAtherton145.3
QLDAyr145.6
QLDBiloela148.6
QLDBlackall157.8
QLDBlackwater148.2
QLDBowen146.2
QLDBrisbane141.3
QLDBundaberg144
QLDCairns146
QLDCharters Towers149.4
QLDChilders142.9
QLDDalby142.4
QLDEmerald146.9
QLDGladstone143.5
QLDGold Coast141.3
QLDGoondiwindi148
QLDGympie143.3
QLDHervey Bay143.9
QLDIngham142.9
QLDInnisfail145.3
QLDKingaroy143.7
QLDLongreach153.9
QLDMackay141.2
QLDMareeba145.9
QLDMaryborough143.2
QLDMiles151.3
QLDMoranbah146.5
QLDMt Isa150.4
QLDRockhampton148.8
QLDRoma148.9
QLDSunshine Coast141
QLDToowoomba139.6
QLDTownsville141.9
QLDTully148.9
QLDWarwick143.7
QLDWhitsunday138.5
QLDYeppoon148.6
SAAdelaide134.9
SABordertown147.9
SACeduna150.6
SAClare138.2
SACoober Pedy160.4
SAKadina139.4
SAKeith145.9
SALoxton147.8
SAMt Gambier146.2
SAMurray Bridge140.6
SANaracoorte143.9
SAPort Augusta138.4
SAPort Lincoln145.2
SAPort Pirie139.1
SARenmark142
SATailem Bend146.4
SAVictor Harbour142.9
SAWhyalla143.5
TASBurnie150.3
TASDevonport149.8
TASHobart150.2
TASHuonville149.9
TASLaunceston149.9
TASNew Norfolk149.9
TASSmithton149.5
TASSorell144.9
TASUlverstone149.9
TASWynard152.5
VICArarat143.1
VICBairnsdale139.6
VICBallarat144.4
VICBenalla145.9
VICBendigo142.4
VICCobram142.5
VICColac145.9
VICCorryong148.2
VICEchuca145.9
VICEuroa140.2
VICGeelong136.3
VICHamilton146
VICHorsham145
VICKoo Wee Rup139.5
VICKyabram143.9
VICLeongatha142.9
VICMelbourne137.9
VICMildura147.5
VICMoe139.9
VICMorwell142.9
VICPortland146.9
VICSale140.9
VICSeymour137.9
VICShepparton143.6
VICSwan Hill146.7
VICTraralgon142.2
VICWallan138.1
VICWangaratta142.3
VICWarrnambool143.8
VICWodonga139.1
VICYarrawonga149.9
WAAlbany146.8
WABoulder151.7
WABridgetown144.9
WABroome165.9
WABunbury137.1
WABusselton141.3
WACarnarvon154.3
WADongara153.9
WAEsperance145.9
WAGeraldton149
WAKalgoorlie149.6
WAKarratha159.9
WAMajimup143.9
WAMount Barker149.2
WAPerth138.3
WAPort Hedland160.2
WAWaroona144.4

Possibly Related Posts (automatically generated):

{ 3 comments… read them below or add one }

1 Magpie January 1, 2012 at 5:19 pm

Happy New Year, Stubborn!

Lately, you don’t post often, but when you do, you post very interesting stuff.

This is interesting on two accounts: the Soup and the data itself.

Unfortunately, I’m way too old to get into Python (or any other snake, for that matter :), but the petrol info is interesting.

Say, this might be a wild guess, but I’d guess in Tasmania petrol is cheaper than average. Maybe even cheapest of all.

2 Danny Yee January 1, 2012 at 5:53 pm

Switzerland is mostly expensive, but petrol is cheaper than in France or Germany. So the borders have supermarkets on one side and petrol stations on the other.

In contrast, Turkey has the most expensive petrol of any country I have visited. This means that almost everyone uses the buses — and some of the inter-city services run to Swiss precision timing and cleanliness, without being too expensive. I think this – whacking exorbitant taxes on petrol – is a vastly better approach than that taken by China or India, where fuel is actually subsidised!

3 Stubborn Mule January 1, 2012 at 10:22 pm

@Magpie: Happy New Year to you too! 2011 has been a very busy year for me…here’s hoping that 2012 will see fit to allow me to post a little more frequently.

As for Tasmania, for the week ending 18 December, the prices ranged from 144.9 cents/L in Sorrell to 155.5 in Hobart, so in the middle of the spectrum.

@Danny: there’s no doubt that economic incentives can make a big difference.

Leave a Comment

Previous post:

Next post: