@@ -542,6 +542,16 @@ attribute:
542
542
... ["UNITS3_9", "N", 8, 0], ["UNITS10_49", "N", 8, 0],
543
543
... ["UNITS50_UP", "N", 8, 0], ["MOBILEHOME", "N", 7, 0]]
544
544
545
+ The first field of a dbf file is always a 1-byte field called "DeletionFlag",
546
+ which indicates records that have been deleted but not removed. However,
547
+ since this flag is very rarely used, PyShp currently will return all records
548
+ regardless of their deletion flag, and the flag is also not included in the list of
549
+ record values. In other words, the DeletionFlag field has no real purpose, and
550
+ should in most cases be ignored. For instance, to get a list of all fieldnames:
551
+
552
+
553
+ >>> fieldnames = [f[0] for f in sf.fields[1:]]
554
+
545
555
You can get a list of the shapefile's records by calling the records() method:
546
556
547
557
@@ -556,7 +566,7 @@ To read a single record call the record() method with the record's index:
556
566
>>> rec = sf.record(3)
557
567
558
568
Each record is a list-like Record object containing the values corresponding to each field in
559
- the field list. A record's values can be accessed by positional indexing or slicing.
569
+ the field list (except the DeletionFlag) . A record's values can be accessed by positional indexing or slicing.
560
570
For example in the blockgroups shapefile the 2nd and 3rd fields are the blockgroup id
561
571
and the 1990 population count of that San Francisco blockgroup:
562
572
0 commit comments