How to remove or delete column fields in a shape file using python?
If you get no joy with QGSVectorLayer::deleteAttribute as they docs say: delete an attribute field (but does not commit it) have a look at the data provider. As QGIS deals with lots of feature types with different drivers I suspect that it's left up to the driver as to whether or not a field can be deleted. Here's some code that I dredged up that may help:
To get the index of the field from the name. In this case I'm not using After getting the index of the field you (might) delete it using the dataprovider.
It's expecting a list so the integer needs to be put into a list. I have not used this method; normally I would use ArcMap to delete the field. |
|||||||||||||||||
|
There's several methods but I will mention the ones I normally use, both using the Python Console. For SINGLE shapefiles:
For MULTIPLE shapefiles:
Hope this helps! |
|||||
|