In [1]:
import shapefile
import numpy as np
import sys,re,csv,os
import matplotlib.pyplot as plt
import cPickle as pickle
import gp_colours
gp_colours.setStyle()
%matplotlib inline


SETTING GP STYLE

In [2]:
centroids=shapefile.Reader("district_centroids.shp")
shapes=centroids.shapes()


---------------------------------------------------------------------------
ShapefileException                        Traceback (most recent call last)
<ipython-input-2-6c97cfa3ecd8> in <module>()
----> 1 centroids=shapefile.Reader("district_centroids.shp")
      2 shapes=centroids.shapes()

/home/ubuntu/anaconda/lib/python2.7/site-packages/shapefile.pyc in __init__(self, *args, **kwargs)
    228         if len(args) > 0:
    229             if is_string(args[0]):
--> 230                 self.load(args[0])
    231                 return
    232         if "shp" in kwargs.keys():

/home/ubuntu/anaconda/lib/python2.7/site-packages/shapefile.pyc in load(self, shapefile)
    261                 self.shp = open("%s.shp" % shapeName, "rb")
    262             except IOError:
--> 263                 raise ShapefileException("Unable to open %s.shp" % shapeName)
    264             try:
    265                 self.shx = open("%s.shx" % shapeName, "rb")

ShapefileException: Unable to open district_centroids.shp

In [1]:
for r,s in zip(centroids.records(),shapes):
    print r,s.points


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-895fb130b91c> in <module>()
----> 1 for r,s in zip(centroids.records(),shapes):
      2     print r,s.points

NameError: name 'centroids' is not defined

In [2]:
from IPython.core.display import HTML
styles = open("../css/custom.css", "r").read()
HTML(styles)


Out[2]:

In [ ]: