Created
October 21, 2016 06:38
-
-
Save manashmandal/a9e23ea9b8c6339e296d2698a7bc0f48 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import geoip2.database | |
mmdb_path = 'C:\\Users\\Manash\\Downloads\\Compressed\\GeoLite2-Country.mmdb\\GeoLite2-Country.mmdb' | |
ipaddress_path = 'C:\\Users\\Manash\\Downloads\\IP_Address.csv' | |
ipdf = pd.read_csv(ipaddress_path) | |
reader = geoip2.database.Reader(mmdb_path) | |
for ip in ipdf['IP Address']: | |
try: | |
print(reader.country(ip).country.name) | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output:
Missing: 21