Build land classes from GIS data
To automatically assign class by all combinations of True/False:
classes.txt:
wheat,rye,barley,walnut
True,True,True,False
True,True,True,True
True,True,True,False
True,True,True,True
import pandas as pd
df = pd.read_csv('/home/bera/Desktop/tempgis/classes.txt', delimiter=',')
df['land_class'] = df.groupby(['wheat','rye','barley','walnut']).ngroup() #https://stackoverflow.com/questions/50050617/assign-unique-numeric-group-ids-to-groups-in-pandas
Results:
df.sort_values(by='land_class')
Out:
wheat rye barley walnut land_class
0 True True True False 0
2 True True True False 0
1 True True True True 1
3 True True True True 1