Tuesday 13 February 2018

Visualize data using Python libraries and D3.js : Alcohol consumption dataset

I just finished a small assignment to visualize the data using different python libraries and also using D3.js.

So far, for this assignment I simply compared patterns in drinking propensities around the globe. My information hotspot for this task is WHO, who introduces the information in liters of unadulterated liquor utilization in the year 2010 around the globe and furthermore alternate types of liquor like Beer, Wine, Spirits, and other mixed drinks for correlation reason.


Utilizing this information I needed to discover which drink is well known in which nation i.e example of drinking among various nations, I additionally needed to see whether a few generalizations are valid around couple of nations like France that they expend more wine than some other mixed refreshment, and so forth. Thus, I will show some theory and attempt to discover visual re-introduction for that speculation.


Dataset
  • Alcohol Consumption dataset
    GHO| Visualizations | Indicator Metadata Registry, WHO http://apps.who.int/gho/data/view.main.CPATBv 
    http://apps.who.int/gho/data/node.wrapper.imr?x-id=462 
  • GEO Location dataset
        - https://datahub.io/core/country-codes#data 
        - http://d3plus.org/topojson/countries.json 
  • Data form
    .csv & .json file format
  • Data collection method
    - For alcohol consumption dataset, I download the csv file.
    - For integrating alcohol consumption dataset and geo location dataset in alpha-2 
    format for continent codes & alpha-3 format for country code, again I download csv.
    - For plotting on world map, I used online topojson country listing which matches with country codes in dataset to plot the graph. 


    Libraries & languages used

    • Python – Pandas, Numpy, Matplotlib, Seaborn, Ipython core
    I utilized above-recorded libraries in anaconda jupyter notebook to peruse, break down information, cleaning information, adjust information according to prerequisite and plot some fundamental insights, besides, I made Horizontal bar charts, stacked visual charts, Correlation combine plots, utilizing Seaborn library. I likewise played out some arranging, combining utilizing pandas libraries.

    • HTML, CSS, JavaScript, D3Js, D3Js plus and Topojson json
    I'm plotting information, for example, sum alcohol utilization and its worldwide positioning on an intuitive world map. I have likewise utilized Tree Maps to show share of every beverage.
    I utilized HTML container for world map and tree map made in D3Plus js. JavaScript utilized for scripting. At last, I utilized TopoJSON for delineate.
     
     “TopoJSON is an extension of GeoJSON that encodes topology. Rather than  representing geometries discretely, geometries in TopoJSON files are stitched together from shared line segments called arcs.” 
Sample: 



Checkout the GitHub page for more detailed steps and code : https://github.com/AbhishekShaha/alcoholConsumption-dataSet

Credits: 
  1. [1]  “Comprehensive country codes: ISO 3166, ITU, ISO 4217 currency codes and many more - Dataset - DataHub - Frictionless Data.” [Online]. Available: https://datahub.io/core/country-codes#data. [Accessed: 02-Dec-2017].
  2. [2]  http://d3plus.org/topojson/countries.json.
  3. [3]  https://seaborn.pydata.org/examples/horizontal_barplot.html
  4. [4] http://bl.ocks.org/davelandry/9042807
    [5] https://bl.ocks.org/davelandry/9874297
    [6] For d3js & d3jsplus library files /codes - https://github.com/alexandersimoes/d3plus