Yesterday, I was working on the ward level parks map of Chennai I had to join a CSV data layer with the boundary polygon layer, but there was one issue while my CSV file has the ward numbers as integers (1,2,3..etc), the polygon layer had them as strings (Ward 1, Ward 2, Ward 3 …etc.,)…… Continue reading QGIS – Creating new column from existing using Python
Sorting is simplified in Python with sorted(). You can even sort with complex rules.
In situations where you have a list of objects and have to retrieve then in random order, dictionaries can act as lookup tables. This tip is not very obvious, hence this explanation: This method employs a iterator looping through the list of users every time we have to find a user, which means we have…… Continue reading Python Tip #8 – reducing looping by using dicts
Sometimes we have to deal with external objects and their attributes. getattr() can save you at those times.
Merge or combine dictionaries ** is the unpacking operator
Check for existence of a key in dictionary and retrieve its value if present.
What if you want to find the first item that matches the condition instead of getting a list of items? next() is a built in function which is not that well known.