GDP by Industry and Country

JohnSnowLabs

Files Size Format Created Updated License Source
2 3MB csv zip 3 months ago John Snow Labs Standard License John Snow Labs CIA World Factbook
Download

Data Files

File Description Size Last changed Download
gdp-by-industry-and-country-csv 2MB csv (2MB) , json (5MB)
gdp-by-industry-and-country_zip Compressed versions of dataset. Includes normalized CSV and JSON data with original data and datapackage.json. 3MB zip (3MB)

gdp-by-industry-and-country-csv  

This is a preview version. There might be more data in the original version.

Field information

Field Name Order Type (Format) Description
Country 1 string GDP Country Name
Currency 2 string
Indicator_Name 3 string Indicator Name with respect to GDP
GDP_Year_1970 4 integer Data of GDP in year 1970
GDP_Year_1971 5 integer Data of GDP in year 1971
GDP_Year_1972 6 integer Data of GDP in year 1972
GDP_Year_1973 7 integer Data of GDP in year 1973
GDP_Year_1974 8 integer Data of GDP in year 1974
GDP_Year_1975 9 integer Data of GDP in year 1975
GDP_Year_1976 10 integer Data of GDP in year 1976
GDP_Year_1977 11 integer Data of GDP in year 1977
GDP_Year_1978 12 integer Data of GDP in year 1978
GDP_Year_1979 13 integer Data of GDP in year 1979
GDP_Year_1980 14 integer Data of GDP in year 1980
GDP_Year_1981 15 integer Data of GDP in year 1981
GDP_Year_1982 16 integer Data of GDP in year 1982
GDP_Year_1983 17 integer Data of GDP in year 1983
GDP_Year_1984 18 integer Data of GDP in year 1984
GDP_Year_1985 19 integer Data of GDP in year 1985
GDP_Year_1986 20 integer Data of GDP in year 1986
GDP_Year_1987 21 integer Data of GDP in year 1987
GDP_Year_1988 22 integer Data of GDP in year 1988
GDP_Year_1989 23 integer Data of GDP in year 1989
GDP_Year_1990 24 integer Data of GDP in year 1990
GDP_Year_1991 25 integer Data of GDP in year 1991
GDP_Year_1992 26 integer Data of GDP in year 1992
GDP_Year_1993 27 integer Data of GDP in year 1993
GDP_Year_1994 28 integer Data of GDP in year 1994
GDP_Year_1995 29 integer Data of GDP in year 1995
GDP_Year_1996 30 integer Data of GDP in year 1996
GDP_Year_1997 31 integer Data of GDP in year 1997
GDP_Year_1998 32 integer Data of GDP in year 1998
GDP_Year_1999 33 integer Data of GDP in year 1999
GDP_Year_2000 34 integer Data of GDP in year 2000
GDP_Year_2001 35 integer Data of GDP in year 2001
GDP_Year_2002 36 integer Data of GDP in year 2002
GDP_Year_2003 37 integer Data of GDP in year 2003
GDP_Year_2004 38 integer Data of GDP in year 2004
GDP_Year_2005 39 integer Data of GDP in year 2005
GDP_Year_2006 40 integer Data of GDP in year 2006
GDP_Year_2007 41 integer Data of GDP in year 2007
GDP_Year_2008 42 integer Data of GDP in year 2008
GDP_Year_2009 43 integer Data of GDP in year 2009
GDP_Year_2010 44 integer Data of GDP in year 2010
GDP_Year_2011 45 integer Data of GDP in year 2011
GDP_Year_2012 46 integer Data of GDP in year 2012
GDP_Year_2013 47 integer Data of GDP in year 2013
GDP_Year_2014 48 integer Data of GDP in year 2014
GDP_Year_2015 49 integer Data of GDP in year 2015

Import into your tool

Data-cli or just data is the program to get and post your data with the datahub.
Use data with the datahub.io almost like you use git with the github. Here are installation instructions.

data get https://datahub.io/JohnSnowLabs/gdp-by-industry-and-country
tree JohnSnowLabs/gdp-by-industry-and-country
# Get a list of dataset's resources
curl -L -s https://datahub.io/JohnSnowLabs/gdp-by-industry-and-country/datapackage.json | grep path

# Get resources

curl -L https://datahub.io/JohnSnowLabs/gdp-by-industry-and-country/r/0.csv

curl -L https://datahub.io/JohnSnowLabs/gdp-by-industry-and-country/r/1.zip

If you are using R here's how to get the data you want quickly loaded:

install.packages("jsonlite", repos="https://cran.rstudio.com/")
library("jsonlite")

json_file <- 'https://datahub.io/JohnSnowLabs/gdp-by-industry-and-country/datapackage.json'
json_data <- fromJSON(paste(readLines(json_file), collapse=""))

# get list of all resources:
print(json_data$resources$name)

# print all tabular data(if exists any)
for(i in 1:length(json_data$resources$datahub$type)){
  if(json_data$resources$datahub$type[i]=='derived/csv'){
    path_to_file = json_data$resources$path[i]
    data <- read.csv(url(path_to_file))
    print(data)
  }
}

Note: You might need to run the script with root permissions if you are running on Linux machine

Install the Frictionless Data data package library and the pandas itself:

pip install datapackage
pip install pandas

Now you can use the datapackage in the Pandas:

import datapackage
import pandas as pd

data_url = 'https://datahub.io/JohnSnowLabs/gdp-by-industry-and-country/datapackage.json'

# to load Data Package into storage
package = datapackage.Package(data_url)

# to load only tabular data
resources = package.resources
for resource in resources:
    if resource.tabular:
        data = pd.read_csv(resource.descriptor['path'])
        print (data)

For Python, first install the `datapackage` library (all the datasets on DataHub are Data Packages):

pip install datapackage

To get Data Package into your Python environment, run following code:

from datapackage import Package

package = Package('https://datahub.io/JohnSnowLabs/gdp-by-industry-and-country/datapackage.json')

# print list of all resources:
print(package.resource_names)

# print processed tabular data (if exists any)
for resource in package.resources:
    if resource.descriptor['datahub']['type'] == 'derived/csv':
        print(resource.read())

If you are using JavaScript, please, follow instructions below:

Install data.js module using npm:

  $ npm install data.js

Once the package is installed, use the following code snippet:

const {Dataset} = require('data.js')

const path = 'https://datahub.io/JohnSnowLabs/gdp-by-industry-and-country/datapackage.json'

// We're using self-invoking function here as we want to use async-await syntax:
;(async () => {
  const dataset = await Dataset.load(path)
  // get list of all resources:
  for (const id in dataset.resources) {
    console.log(dataset.resources[id]._descriptor.name)
  }
  // get all tabular data(if exists any)
  for (const id in dataset.resources) {
    if (dataset.resources[id]._descriptor.format === "csv") {
      const file = dataset.resources[id]
      // Get a raw stream
      const stream = await file.stream()
      // entire file as a buffer (be careful with large files!)
      const buffer = await file.buffer
      // print data
      stream.pipe(process.stdout)
    }
  }
})()
Datapackage.json