I have a geopackage file, with a layer called "MyLayer". Within this I have an attribute table with approx 20 attributes.
I can read in each attribute individually like:
import geopandas as gpd geopkg = gpd.read_file('MyGeoPkg.gpkg', layer='MyLayer') A = geopkg['AttributeA']
However, I have multiple GPKG files and they may have a different number of attributes, that may have different names.
I'd like to automatically get a list like:
listOfAttributes = ['AttributeA', 'AttributeB', 'AttributeC']
so I could then do:
for l in listOfAttributes: data = geopkg[l]
Is there a way of getting a list of the field names from the layer so I can iterate over them?