Remapping Cities

This notebook shows how to remap 15,000 cities with UMAP and tSNE.

In [1]:
import math
import pandas as pd

# pip install sklearn
from sklearn.manifold import TSNE
In [2]:
data = pd.read_csv('cities15000.csv', names=['name', 'country', 'pop', 'lat','lon'], header=0).sort_values(by=['pop'], ascending=[0])
data['country'] = data['country'].map(str)
In [3]:
# comment out this line for a smaller dataset
#data = data[0:2000]
In [4]:
## load holoviews
# conda install bokeh
# conda install -c bokeh holoviews
import holoviews as hv
from holoviews.streams import RangeXY
from holoviews.operation.datashader import aggregate, datashade, dynspread, shade
from holoviews.operation import decimate