Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 2581

For processes that involve enumeration or listing the finite number of iterations in an object, layer, feature, or other measurable instance.

6 votes

Getting number of features in the Attribute table using PyQGIS

layer.getFeatures() is a Python Iterator (type: QgsFeatureIterator) so num_of_features = len(list(layer.getFeatures())) or you can use list comprehension: num_of_features = len([feature for feature i …
gene's user avatar
  • 55.4k
3 votes

Counting vertices and adding it as number to column using shapely

In Modify pandas DataFrame within iterrows loop The rows you get back from iterrows are copies that are no longer connected to the original data frame, so edits don't change your DataFrame. However, …
gene's user avatar
  • 55.4k
7 votes

Getting the number of features in shapefile without opening it using Python

If you only need the number of features, use the standard Python module struct (used by pyshp). You only need to read the first bytes of the dbf or the .shp files (Raw Binary Files): a) .dbf file : t …
gene's user avatar
  • 55.4k