Web Scraping and Data Analysis of Wines on Vivino.com
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.
As someone with a taste for good red wine and coffee but with the limited funds of a student, I decided to web-scrape data from my favorite app, Vivino.com by using Python and Selenium where I scraped information about 16,690 bottles of wines. Vivino is the “go-to” app when you want to discover good red wines, especially on a student budget. Thus, the prices range from $10 - $6,000 a bottle, so it should be possible finding a wine matching almost everyone preference and budget.
After couple of hunts for good affordable wines, I started wondering: what drives the rating at Vivino? What countries and regions should I look against to find high rated “cheap” red wines. Those are the questions I explore throughout this blog post.
What is Vivino?
Vivino is a Danish founded company and is today the most downloaded wine app, used by more than 26 million users around the world. With millions of wines featured, the database makes up the most extensive wine library in the world. Vivino has established a community and developed an app, which especially is great for us who love red wine but aren’t sommeliers-in-training. The Vivino app enables consumers to snap a photo of a bottle’s label, and the app will immediately pull up information about the wine, its rating score, reviews and much more.
I scraped the following variables on Vivino.com:
- Wine Name
- Grape variety (Red, White, Sparkling)
- Region (Wine region of the country)
- Country of origin
- #Reviews (Number of reviews given to a specific bottle by consumers)
- Average price per bottle
- Rating Score (Overall consumer rating, measured on a scale from 0-5)
A few stats about the dataset:
- The dataset contains 16,690 bottles scraped on Vivino.com
|Red wine||White wine||Sparkling wine|
|Number of bottles||12141||3368||1181|
|Price range||$10 - $3520||$8.99 - $5999||$10.49 - $4179.98|
|Min & Max rating||2.3 - 4.9||2.4 - 4.9||3.2 - 4.8|
|Total number of reviews||8654903||1405111||131406|
This descriptive analysis is based on data scraped from vivino.com. Please, notice that I have limited the price range, so the prices per bottle range from $8.99 - $500. This means that 169 observations have been dropped from the scrapped dataset, corresponding to ~1% of the dataset.
Red wine, White wine & Sparkling wine
The box plot reveals that the median rating for red wine tends to be slightly higher compared to white wine and sparkling wine. The majority of the red wines obtain a rating approximately between 3.5 - 4.0 (the interquartile range box). Further, it should be noted that the rating for red wine, white wine and sparkling wine seems to be normally distributed, though there are a few outliers. An interesting observation is that a slightly wider rating range for red wine is observed compared to what we see for the white wine and sparkling wine categories.
Price seems to correlate with rating
I expected to see this correlation. The overall average rating score per bottle and price seems to “some extent” to correlate, particularly for red and sparkling wine. The correlation coefficient reveals a “somewhat” strong relationship between rating and price for red wine (0.68) and sparkling wine (0.69), while the correlation for white wine is significantly smaller(0.57). However, that correlation peters out for red wine priced above $100 a bottle; the rating only increases slightly in tandem with the price at that point.
How does red wine rating differ from white wine rating?
As observed at the initial boxplot, a slightly wider rating range was observed for red wines, which is why I decided to look into the “spread of the data points” around the average rating (variance) for red and white wine. I wanted to investigate whether ratings for red wine have a higher variance than white wine.
H0: Variance of average(rating red wine) = Variance of average(rating white wine)
H1: Variance of average(rating red wine) ≥ Variance of average(rating white wine)
The variance test revealed an extremely low p-value (2.2e-16), why the null hypothesis is rejected, in favor of the alternative, the rating for red wines has a higher variance compared to white wine. The higher variance for red wine rating can be caused by several factors. Some part of the explanation might originate from the fact that red wine and white wine are served at two different temperature.
A common rule of thumb is that red wine is best served between 50F and 65F, while white wines are best served between 45F and 50F. As too much cooling causes a loss of flavor, the odds of flavor loss are higher for white wine than for red. Lastly, red wines are typically aged in oak barrels, while white is aged in stainless steels vats. These two entirely different processes result in two distinct taste experiences. The variety of flavor experience tasting a red wine versus white wine are bigger, and could, therefore, be a part of the explanation why the data points for the rating of red wine are more dispersed.
Deep-diving into my favorite, red wine......
Nothing really changes here compared to the previous scatterplot. However, it’s again worth pointing out that it’s possible to buy a red wine with top rating for around $75 - $100.
Old wines achieve high ratings
The jump in the year is because no bottles were present in the missing years in the scraped data. The scatter plot reveals a correlation at -0.377, which could indicate that an increase in the year will decrease the rating. Therefore, we need to test whether it’s significant or not.
An interesting insight here is that older wines tend to have a more narrow rating range, an increase in years also increases the range of rating. This could indicate that old wines are quality wines, wines which people have saved. While the wider rating range for newer wine indicates that from a consumer perspective that both quality and lower quality wines are produced. In sum, the plot makes intuitively good sense when considering year and rating within red wines.
The United States surprise
The boxplot reveals, from my perspective, a quite surprisingly insight! Wines in the United States have on average a low price, while the median rating is the highest compared to the remaining countries. That would indicate that wine lovers who want a decent quality for a reasonable price should look at wines from the US!
Is French really better?
I have often heard that French wines are the best. During my internship at adidas, I had the privilege to live with a French mate for a few months, and we often discussed why people tend to claim that French wines should be a better choice (my mate tried several times to convince me). With the scraped data from Vivion.com, I can check if the ratings support the claim of french superiority.
H0 : Average rating France = Average rating remaining countries
H1 : Average rating France ≥ Average rating remaining countries
My test revealed that the scraped data did not contain any evidence that the average rating for France wines is higher than the remaining countries.
Zooming in at the more budget friendly wines - Top 30 red wines under $30:
Next, I wanted to figure out which regions and bottles to look for within a reasonable budget. Therefore, I specified the following requirements:
- A bottle should at least have received 100 reviews
- Price below $30
- A minimum average score at 4.1
The graph confirms the previous boxplot, wine lovers who want quality (high rating) red wine for a reasonable price should indeed look at wines from the US!
Statistical Data Analysis
Playing around with scraped data revealed some interesting and surprising insights, which pointed me in the direction of the following question. Can the predictors, price and year explain the obtained rating score for red wines at Vivino? Therefore, I decided to test the following model:
Rating Score = β0 + β1 √price + β2 #Number of reviews per bottle + ε
The analysis was carried out in R-studio where I obtain the following output of my regression analysis.
|#Number of reviews per bottle||7.265e-06||0.0003271||2.221||<0.0264|
The adjusted R-squared for this model was 0.5306, which is decent given the few number of predictors; price and year. The model reveals that the baseline rating score for red wines at Vivino.com is 3.6. Further, every unit increase in √price would increase the rating by 0.053, while each additional reviews increase the rating score by 0.000007265. This means that it takes 137,646 reviews to bump the rating by 1 point. It requires a significant amount of reviews to move the rating.
- Red wine seems to have a slightly higher median rating compared to White wine and Sparkling wine.
- There is a strong correlation between rating and price for red wine, white wine, and sparkling wine.
- Older red wines have a more narrow rating range, while younger wines have a wider rating range.
- Red wines from the USA have a generally higher median rating compared to the remaining countries in the scraped dataset.
- Red wine ratings have a significantly higher variance compared to white wine ratings.
- The scraped data contains no evidence for that red wines from French have significantly higher rating compared to the remaining countries in the dataset.
- Looking for high rating wine below $30 based on more than 100 reviews? Look for wines in the USA.
- 53% of the rating per bottle can be explained by the price and number of reviews.
- Selenium as a scraping tool is significantly slower than Beautifulsoup and Scrapy. Thus, the structure of the site (infinite scroll) forced me in this direction.