<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi all,</div><div><br></div><div>I needed to gather basic stats for a layer containing multiple fields. I created the following gist to compute the number of features per each unique value for a list of given fields</div><div><a href="https://gist.github.com/mdouchin/a234efb7e67ebd8dae3a04cb26cf5e72">https://gist.github.com/mdouchin/a234efb7e67ebd8dae3a04cb26cf5e72</a></div><div><br></div><div>I know I could use PostgreSQL to do it (see <a href="https://twitter.com/kimaidou/status/1100053546978983936">https://twitter.com/kimaidou/status/1100053546978983936</a> conversation), wich is much faster, but I needed a quick way to do it with Python.</div><div>I tested virtual layers too, but my source layer has many fields (with some heavy data) and the copy/pasting into spatialite was not efficient here.<br></div><div><br></div><div>The method uniqueValues(fieldIndex) of QgsVectorLayer is pretty fast compared to my iteration through the layer features. Any hint how to improve the speed of my calculation ?</div><div><br></div><div>Regards,</div><div>MichaĆ«l<br></div></div></div></div></div>