Skip to content

Turning IP address into location #1

@Enturk

Description

@Enturk

In dropbox we have a csv file sorted by IP with values for countries, regions, and cities, updated to May 2015.

I'm going to have to build on this arff file maker to add the countries, regions, and cities as nominal values to the relative attribute, and then also add them to the appropriate events (lines). Probably something along the lines of:

after loading country & region & city nominal attribute lists into balanced tree at start
for line of input file:
    #sort through other stuff
    for row in csv.reader(dbip-city-2017-05.csv):
        if (row[0] => IPaddress && row[1] <= IPaddress):
            country = row[2]
            region = row[3]
            city = row[4]
            break
    append country & region & city to attribute balanced tree
    append country & region & city to event
[after cycling through all the events' IP addresses] 
rewrite country & region & city nominal attribute lists

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions