IPv4 Geolocation

JohnSnowLabs

Files Size Format Created Updated License Source
2 62MB csv zip 1 week ago John Snow Labs Standard License John Snow Labs Maxmind GeoLite2
Download

Data Files

File Description Size Last changed Download Other formats
ipv4-geolocation-csv [csv] 10MB ipv4-geolocation-csv [csv] ipv4-geolocation-csv [json] (39MB)
ipv4-geolocation_zip [zip] Compressed versions of dataset. Includes normalized CSV and JSON data with original data and datapackage.json. 2MB ipv4-geolocation_zip [zip]

ipv4-geolocation-csv  

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

Field information

Field Name Order Type (Format) Description
IPv4_Network_Address 1 string This is the IPv4 (Internet Protocol Version 4) network in CIDR format such as 2.21.92.0/29.
Geoname_Id 2 integer A unique identifier for the network’s location as specified by GeoNames.
Continent_Code 3 string The continent code for this IP (Internet Protocol). Possible codes are: AF - Africa, AS - Asia, EU - Europe, NA - North America, OC - Oceania, SA - South America
Continent_Name 4 string The continent name for this location
Country_ISO_Code 5 string A two-character ISO 3166-1 country code for the country associated with the location.
Country_Name 6 string The country name for this location.
Is_Anonymous_Proxy 7 boolean A 1 if the network is an anonymous proxy, otherwise 0.
Is_Satellite_Provider 8 boolean A 1 if the network is for a satellite provider that provides service to multiple countries, otherwise 0.

ipv4-geolocation_zip  

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

Read me

Import into your tool

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

install.packages("jsonlite")
library("jsonlite")

json_file <- "http://datahub.io/JohnSnowLabs/ipv4-geolocation/datapackage.json"
json_data <- fromJSON(paste(readLines(json_file), collapse=""))

# access csv file by the index starting from 1
path_to_file = json_data$resources$path[1][1]
data <- read.csv(url(path_to_file))
print(data)

In order to work with Data Packages in Pandas you need to install the Frictionless Data data package library and the pandas extension:

pip install datapackage
pip install jsontableschema-pandas

To get the data run following code:

import datapackage

data_url = "http://datahub.io/JohnSnowLabs/ipv4-geolocation/datapackage.json"

# to load Data Package into storage
storage = datapackage.push_datapackage(data_url, 'pandas')

# data frames available (corresponding to data files in original dataset)
storage.buckets

# you can access datasets inside storage, e.g. the first one:
storage[storage.buckets[0]]

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('http://datahub.io/JohnSnowLabs/ipv4-geolocation/datapackage.json')

# get list of resources:
resources = package.descriptor['resources']
resourceList = [resources[x]['name'] for x in range(0, len(resources))]
print(resourceList)

data = package.resources[0].read()
print(data)

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 = 'http://datahub.io/JohnSnowLabs/ipv4-geolocation/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 the first data file in this dataset
  const file = dataset.resources[0]
  // Get a raw stream
  const stream = await file.stream()
  // entire file as a buffer (be careful with large files!)
  const buffer = await file.buffer
})()

Install the datapackage library created specially for Ruby language using gem:

gem install datapackage

Now get the dataset and read the data:

require 'datapackage'

path = 'http://datahub.io/JohnSnowLabs/ipv4-geolocation/datapackage.json'

package = DataPackage::Package.new(path)
# So package variable contains metadata. You can see it:
puts package

# Read data itself:
resource = package.resources[0]
data = resource.read
puts data
Datapackage.json