Population Figures By Country

JohnSnowLabs

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

Data Files

File Description Size Last changed Download
population-figures-by-country-csv 127kB csv (127kB) , json (479kB)
population-figures-by-country_zip Compressed versions of dataset. Includes normalized CSV and JSON data with original data and datapackage.json. 229kB zip (229kB)

population-figures-by-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_Name 1 string Name of the country
Country_Code 2 string Code assigned to the country by the World Bank.
Population_in_1960 3 integer Population of the country in 1960
Population_in_1961 4 integer Population of the country in 1961
Population_in_1962 5 integer Population of the country in 1962
Population_in_1963 6 integer Population of the country in 1963
Population_in_1964 7 integer Population of the country in 1964
Population_in_1965 8 integer Population of the country in 1965
Population_in_1966 9 integer Population of the country in 1966
Population_in_1967 10 integer Population of the country in 1967
Population_in_1968 11 integer Population of the country in 1968
Population_in_1969 12 integer Population of the country in 1969
Population_in_1970 13 integer Population of the country in 1970
Population_in_1971 14 integer Population of the country in 1971
Population_in_1972 15 integer Population of the country in 1972
Population_in_1973 16 integer Population of the country in 1973
Population_in_1974 17 integer Population of the country in 1974
Population_in_1975 18 integer Population of the country in 1975
Population_in_1976 19 integer Population of the country in 1976
Population_in_1977 20 integer Population of the country in 1977
Population_in_1978 21 integer Population of the country in 1978
Population_in_1979 22 integer Population of the country in 1979
Population_in_1980 23 integer Population of the country in 1980
Population_in_1981 24 integer Population of the country in 1981
Population_in_1982 25 integer Population of the country in 1982
Population_in_1983 26 integer Population of the country in 1983
Population_in_1984 27 integer Population of the country in 1984
Population_in_1985 28 integer Population of the country in 1985
Population_in_1986 29 integer Population of the country in 1986
Population_in_1987 30 integer Population of the country in 1987
Population_in_1988 31 integer Population of the country in 1988
Population_in_1989 32 integer Population of the country in 1989
Population_in_1990 33 integer Population of the country in 1990
Population_in_1991 34 integer Population of the country in 1991
Population_in_1992 35 integer Population of the country in 1992
Population_in_1993 36 integer Population of the country in 1993
Population_in_1994 37 integer Population of the country in 1994
Population_in_1995 38 integer Population of the country in 1995
Population_in_1996 39 integer Population of the country in 1996
Population_in_1997 40 integer Population of the country in 1997
Population_in_1998 41 integer Population of the country in 1998
Population_in_1999 42 integer Population of the country in 1999
Population_in_2000 43 integer Population of the country in 2000
Population_in_2001 44 integer Population of the country in 2001
Population_in_2002 45 number Population of the country in 2002
Population_in_2003 46 number Population of the country in 2003
Population_in_2004 47 number Population of the country in 2004
Population_in_2005 48 number Population of the country in 2005
Population_in_2006 49 number Population of the country in 2006
Population_in_2007 50 number Population of the country in 2007
Population_in_2008 51 number Population of the country in 2008
Population_in_2009 52 number Population of the country in 2009
Population_in_2010 53 number Population of the country in 2010
Population_in_2011 54 number Population of the country in 2011
Population_in_2012 55 number Population of the country in 2012
Population_in_2013 56 number Population of the country in 2013
Population_in_2014 57 number Population of the country in 2014
Population_in_2015 58 number Population of the country in 2015
Population_in_2016 59 integer Population of the country in 2016

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/population-figures-by-country
tree JohnSnowLabs/population-figures-by-country
# Get a list of dataset's resources
curl -L -s https://datahub.io/JohnSnowLabs/population-figures-by-country/datapackage.json | grep path

# Get resources

curl -L https://datahub.io/JohnSnowLabs/population-figures-by-country/r/0.csv

curl -L https://datahub.io/JohnSnowLabs/population-figures-by-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/population-figures-by-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/population-figures-by-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/population-figures-by-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/population-figures-by-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