A 3 295 Euro Renault, with 136 500 km (84 817 miles)

Greetings from Montpellier,

Introduction. Great news: I got a job. Not-so-great news: To get to work each day, I’ll need a car, probably a used one. But there is a silver lining to this new item on my shopping list: an exciting data science project, because I have many questions. Which car brands are most common in France, particularly in Montpellier, and how old are they? How much should I expect to pay? Will it be absolutely necessary to buy a manual transmission car? Most cars here run on gas, right?

I will need data too, so enter Leboncoin.com, Python and BeautfulSoup. Leboncoin is the most popular online service for classifieds in France and comparable to Craigslist in the US.

Screen Shot 2016-05-25 at 10.02.09 AM.png

One can find almost anything on Leboncoin– rental properties, random junk, employment gigs, services, and vehicles. Below, I searched Leboncoin for cars (voiture in French) in Montpellier, and 245 listings that go as far back as April 7th are returned. A click on a listing yields a standardized page including date of listing, price, city, brand, model, model year, mileage, fuel type, and transmission.

Methods. All of the information on those pages constitutes data that could be analyzed to explore the used car market of Montpellier. How might one efficiently extract data from these webpages? Python and BeautifulSoup come to the rescue. Python is a computer scripting language, one that I used for a previous blog post that explored wineries in France. BeautifulSoup is a library of Python code that can be called to pull text and data out of webpages. Recall that at the core of nearly any webpage is Hypertext Markup Language, HTML, and below are sections of HTML from the two pages above.

Do not worry; HTML is not supposed to intelligible to most people, including me. But it can be referenced easily with a little magic and BeautifulSoup. The underlying premise of BeautifulSoup is that text and data in each page have a tag that can referenced; grab the text from the tag of your choice to scrape a webpage. Here’s an application of magic to Leboncoin:

The Python code (above left) imports a few libraries, including BeautifulSoup; calls the webpage with results from the search; pulls the webpage address for each of those results; and scrapes data from each listing with BeautifulSoup. I wrote my script to aggregate the scraped data into a CSV file (above right) that I loaded into another program (RStudio) for statistical analysis. For our purposes, stats applied to the data are descriptive (i.e., means, medians, bar charts, histograms, box plots, etc).

Results. Listings on Leboncoin represented thirty-one car brands. The distribution below shows the top ten most common brands, and Renault, Peugeot and Citroen took the lead. Longue vie à la France!

Screen Shot 2016-05-25 at 10.50.49 AM

Median and mean ages for listings with the top ten brands were 10.0 and 10.7 years old, respectively, and the most common brand, Renault, had a median and mean car age of 11.0 and 11.8 years, respectively. We can see the age distribution of listed vehicles:

Screen Shot 2016-05-25 at 10.51.35 AM.png

Vehicle mileage is critical too. Median and mean mileage were 134 700 km and 136 600 km, respectively, for all vehicles in the top ten brands. For Renault, median and mean were 136 500 km and 136 200 km, respectively.

How much should I expect to pay? The median and mean prices for the top ten common brands were 4 990 euros (US$ 5 563) and 6 557 euros (US$ 7 309), respectively. For a Renault, the most common brand, median and mean were 3 295 euros (US$ 3 672) and 4 399 euros (US$ 4 903), respectively.* Notwithstanding, the likely price for a particular vehicle depends on its individual features, wear and use. In a future post, I will develop a regression model for a nuanced prediction of what I might expect to pay. For now, here’s a lay of the land:

Screen Shot 2016-05-25 at 11.38.58 AM.png

Screen Shot 2016-05-25 at 10.48.21 AM

Screen Shot 2016-05-25 at 10.48.58 AM

Finally, a summary of fuel type and transmission:

Screen Shot 2016-05-25 at 10.47.58 AM

Learning to drive a stick would do me well, unless I have a penchant for a Citroen or BMW:

Screen Shot 2016-05-25 at 10.48.13 AM

Conclusions. To explore the used car market in Montpellier, France, Leboncoin listings for used cars between April 7th and May 24th were programmatically “scraped.” Data such as brand, model, price, and other features for each listing were analyzed. Of thirty-one brands, descriptive analysis was applied to listings that corresponded to the ten most common brands(n = 195 vehicles), of which the median price was 4 990 euros (US$ 5 563). French Renault, Peugeot, and Citroen constituted the most common brands, totaling 105 vehicles. But a Toyota (n = 9) still is not off the table! This analysis makes clear that more choices are to be had for drivers with a penchant for manual transmissions (n = 166) and diesel engines (n = 137). The price of any used vehicle depends on mileage and other factors, and future analysis should include a regression model to 1) infer significant determinants of price and 2) develop a predictive model of pricing.

 

 

*Conversion based on an exchange rate of 1.11 US$ / euro

Visit to Grenoble, Rhône-Alpes

Two weeks ago, I spent a lovely weekend in the French city Grenoble. Here’s a peek of the sites. Enjoy!

Grenoble- Historic City Center

 

Cable car ride up to Grenoble´s 17th century Bastille

Detour: Jerusalem and Tel Aviv

France is wonderful, but a temporary change in scenery is never a bad thing. Thus a trip to Israel was in order. Here are some shots of my visit to Jerusalem.

OLYMPUS DIGITAL CAMERA

Old City of Jerusalem

OLYMPUS DIGITAL CAMERA

Western Wall

OLYMPUS DIGITAL CAMERA

Old City of Jerusalem

OLYMPUS DIGITAL CAMERA

Western Wall

OLYMPUS DIGITAL CAMERA

Temple Mount

OLYMPUS DIGITAL CAMERA

Shawarma, a local delicacy

OLYMPUS DIGITAL CAMERA

City of David, Jerusalem

OLYMPUS DIGITAL CAMERA

Kidron Valley

OLYMPUS DIGITAL CAMERA

City of David, Jerusalem

OLYMPUS DIGITAL CAMERA

City of David, Jerusalem

OLYMPUS DIGITAL CAMERA

Tunnels in the City of David

OLYMPUS DIGITAL CAMERA

Tunnels in the City of David

OLYMPUS DIGITAL CAMERA

The City of David

 

Of course, I enjoyed Israel’s plentiful delicacies, including baklava;

 

an excursion to Masada at daybreak;

 

Ein Gedi nature reserve;

OLYMPUS DIGITAL CAMERA

OLYMPUS DIGITAL CAMERA

and the dead sea for a good soak.

Hiking Le Grotte de Fées

Last weekend, off we went to Le Grotte de Fées (Google Translator: “The Fairy Caves”?) near the town of Montpeyroux, a 30 minute drive from Montpellier.

montpeyroux

Our 16 km hike included spectacular views of chaparral studded ridges, stalactite-filled caves, ruins of a castle, and vineyards in the distance.

 

Above, the village of Montpeyroux, where we began. After a short climb, we reached a medieval castle, below, that overlooked the town.

OLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERA

We continued through dry ridges, with a typical arid, mediterranean ecosystem.OLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERA

And we even checked out some caves…

All the while, accompanied by our trusty friend: Glasgow.

OLYMPUS DIGITAL CAMERA

Fromage

Greetings All,

This update is about cheese and data– inspired by France’s steadfast dedication to dairy products and an R-blogger’s post evaluating European unemployment based on data acquired through the Eurostat database, respectively. Combining French cheese, data and too much time on my hands, I created interactive figures to explore Europe’s cheese production and the relatively minor US consumption of it. My interactive vignette can be found here (do check it out!):

 https://jschwartzbord.shinyapps.io/euro_cheese/

Briefly, we see that:

(A) Germany, France, and Italy were Europe’s largest producers of cheese in 2014;Screen Shot 2016-02-16 at 9.27.35 PM

 

(B) French cheese production climbed steadily from 2003 to 2013, from 1,800,000 metric tons to nearly 2,000,000 metric tons; and

Screen Shot 2016-02-16 at 9.27.58 PM

 

(C) France’s cheese exports to the USA were paltry (i.e., ~19,000 metric tons in 2003) compared to its gargantuan million+ metric tons of production.

Screen Shot 2016-02-16 at 9.28.21 PM

But do not take my word for it. Look at my fully interactive set of figures, and original data at Eurostat and the USDA Foreign Agriculture Service.

Now that we’ve gotten my data out of the way, how does the cheese look like in my neck of the woods?  Options abound:

First, you could go to the bodega down the street (below, left) and check out the President Brie, Baby Bell and Italian salami. Laughing Cow cheese (vache qi rit, below, right) is also available.

 

Walk up the street a little, and you’ll find the nearby bio (i.e., organic) bodega, called the Folle Avoine, which the avuncular owner stocks with exquisite fruits and vegetables, like the nicest endive I’ve ever seen. His cheese options aren’t shabby either:

OLYMPUS DIGITAL CAMERA

Folle Avoine-Cheese

OLYMPUS DIGITAL CAMERA

Folle Avoine- Cheese

OLYMPUS DIGITAL CAMERA

Folle Avoine- Bread

The really good stuff, however, is another block and a half away: L’ Art du Fromage. No need to say more.

OLYMPUS DIGITAL CAMERA

L’art du fromage

Recognize any cheeses here?

 

So do not fret. When in doubt, head to the local fromagerie (or Whole Foods or Trader Joes in a pinch), buy that wedge of goat milk bleu cheese, and pair with a proper wine. Ta da!

OLYMPUS DIGITAL CAMERA

Kir with two goat cheese and a cow’s milk Beaufort

Foray in Montpellier, Some Photos, and Data (If I´m Lucky)

As most of my family and friends know, I recently moved to Montpellier, France– without any particular vocation awaiting me here. For now I’m taking time to recover from my PhD (i.e., too many peanuts), embark on some personal projects (i.e., become a better data scientist), and get to know this pleasant city.  It will be “home” for the next two years. In the meantime I’m snapping photos, and some friends and family have asked that I share. Furthermore, I’ve transitioned into autodidact mode to become a better programmer pursuant to data science, equipping myself to robustly procure, scrape, store, clean up, analyze, interpret and share novel data. (Perhaps mini-projects like this, by an industrious R-bloggers correspondent). And what better motivation to do a decent job at those tasks than to force data-informed musings upon my friends and family!

Enter this blog. Here I’ll share pictures, experiences from my sojourn in the south of France, and data science projects that I’m cooking up. My hope is that all three inform one another. For now, some pictures:

Above, shots from the Promenade du Peyrou in Montpellier, including the arches of the Saint Clement Aqueducts, the Chateau d’Eau, King Louis XIV on his horse, and a replica of the Arc d’ Triomphe.

 

And below, images from two neighborhoods in Montpellier: Beaux Arts and the Historic Center.

OLYMPUS DIGITAL CAMERA

Beaux Arts on foot

OLYMPUS DIGITAL CAMERA

Beaux Arts on foot

OLYMPUS DIGITAL CAMERA

Beaux Arts on foot

OLYMPUS DIGITAL CAMERA

Historic Center of Montpellier

OLYMPUS DIGITAL CAMERA

Historic Center of Montpellier

OLYMPUS DIGITAL CAMERA

Historic Center of Montpellier

OLYMPUS DIGITAL CAMERA

Beaux Arts of Montpellier

OLYMPUS DIGITAL CAMERA

Beaux Arts of Montpellier