Skip to main content
deleted 45 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

I am new to PyQGIS and I want to add one more field in my existed table. Here is my code:

pointLayer = QgsVectorLayer(uri, 'my_layer', 'delimitedtext')
pointLayer.dataProvider().addAttributes([QgsField("new1", QVariant.Double)])
pointLayer.updateFields()

However, there's no difference if I print the names of the field before and after adding attributes respectively.

enter image description here

I don't know how to fix the problem and the code does not have any error. I will appreciate it if you can help me out.

I am new to PyQGIS and I want to add one more field in my existed table. Here is my code:

pointLayer = QgsVectorLayer(uri, 'my_layer', 'delimitedtext')
pointLayer.dataProvider().addAttributes([QgsField("new1", QVariant.Double)])
pointLayer.updateFields()

However, there's no difference if I print the names of the field before and after adding attributes respectively.

enter image description here

I don't know how to fix the problem and the code does not have any error. I will appreciate it if you can help me out.

I am new to PyQGIS and I want to add one more field in my existed table. Here is my code:

pointLayer = QgsVectorLayer(uri, 'my_layer', 'delimitedtext')
pointLayer.dataProvider().addAttributes([QgsField("new1", QVariant.Double)])
pointLayer.updateFields()

However, there's no difference if I print the names of the field before and after adding attributes respectively.

enter image description here

I don't know how to fix the problem and the code does not have any error.

Title changed, Content Structured, Three tags added
Source Link
Taras
  • 34.1k
  • 4
  • 73
  • 148

Adding attributes to pyQGISCSV-file using PyQGIS

I am new to pyQGISPyQGIS and I want to add one more field in my existed table. Here is my code:

pointLayer = QgsVectorLayer(uri, 'my_layer', 'delimitedtext')
pointLayer.dataProvider().addAttributes([QgsField("new1", QVariant.Double)])
pointLayer.updateFields()

However, there's no difference if I print the names of the field before and after adding attributes respectively.   

enter image description here

I don't know how to fix the problem and the code does not have any error. I will appreciate it if you can help me out.

Adding attributes to pyQGIS

I am new to pyQGIS and I want to add one more field in my existed table. Here is my code:

pointLayer = QgsVectorLayer(uri, 'my_layer', 'delimitedtext')
pointLayer.dataProvider().addAttributes([QgsField("new1", QVariant.Double)])
pointLayer.updateFields()

However, there's no difference if I print the names of the field before and after adding attributes respectively.  enter image description here

I don't know how to fix the problem and the code does not have any error. I will appreciate it if you can help me out.

Adding attributes to CSV-file using PyQGIS

I am new to PyQGIS and I want to add one more field in my existed table. Here is my code:

pointLayer = QgsVectorLayer(uri, 'my_layer', 'delimitedtext')
pointLayer.dataProvider().addAttributes([QgsField("new1", QVariant.Double)])
pointLayer.updateFields()

However, there's no difference if I print the names of the field before and after adding attributes respectively. 

enter image description here

I don't know how to fix the problem and the code does not have any error. I will appreciate it if you can help me out.

Source Link

Adding attributes to pyQGIS

I am new to pyQGIS and I want to add one more field in my existed table. Here is my code:

pointLayer = QgsVectorLayer(uri, 'my_layer', 'delimitedtext')
pointLayer.dataProvider().addAttributes([QgsField("new1", QVariant.Double)])
pointLayer.updateFields()

However, there's no difference if I print the names of the field before and after adding attributes respectively. enter image description here

I don't know how to fix the problem and the code does not have any error. I will appreciate it if you can help me out.