Setup code
>>> import shapefile
>>> sf = shapefile.Reader("shapefiles/blockgroups")
>>> records = sf.records()
Record Alignment issue in pyshp version 1.2.9.
From the doctests
"Let's read the blockgroup key and the population for the 4th blockgroup:"
>>> records[3][1:3]
['060750601001', 4715]
pyshp version 1.2.3, Python 2.7
In [9]: records[3][1:3]
Out[9]: [u'060750601001', 4715]
pyshp version 1.2.9, Python 2.7.12
In [15]: records[3][5:7]
Out[15]: ('060750601001', ' 4715')
pyshp version 1.2.9, Python 3.5.2
(Each subsequent record has move the fields over by 1 value.)
In [5]: records[3][5:7]
Out[5]: (b'060750601001', b' 4715')
In [10]: records[4][6:8]
Out[10]: (b'060750102001', b' 473')
In [11]: records[5][7:9]
Out[11]: (b'060750126001', b' 1137')
The length of sf.records() has changed...
That issue could be explained by the record alignment issue.
In all versions tests this works...
pyshp 1.2.3
pyshp 1.2.9
There are a total of five (5) failing tests. This could solve one (1) of those failing tests.
EDIT Additional Info:
The "DeletionFlag" field is being put in the output of the records
function caused by PR #62 (@karimbahgat). The record
function works fine.
For instance:
pyshp 1.2.3, Python 2.7
In [35]: records[0][:5]
Out[35]: [0.96761, u'060750179029', 4531, 4682.7, 970]
pyshp 1.2.9, Python 2.7
In [49]: records[0][:5]
Out[49]: (' ', ' 0.96761', '060750179029', ' 4531', ' 4682.7')