I have features and each of them has an attribute about what it is. In my case, I have points representing trees and each tree has its species name as an attribute.
I would like to group them by species name and using numbers from 1 to n as seen on picture and if possible, not by hand because sometimes I have hundreds of species. I was thinking of some kind of expression which includes $rownum and tried a few things but no results. SQL queries also came to mind, but I have limited experience with them and I've never given them a try in QGIS.
I really don't want to export data to a spreadsheet, I would like to solve this in QGIS if possible.