Skip to main content
Post Reopened by PolyGeo
Post Closed as "Not suitable for this site" by PolyGeo
edited tags
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Parsing Splitting field in ArcGIS field calculator using Python Parser?

I'm using field calculator in ArcGIS Desktop 10.2.1.

I have field1 which has a values of "A_B" (example). I created two fields out of this, values to the left of the underscore go in fielda and to the right of the underscore go in fieldb. I used the code below in field calculator to separate them out into two fields.

fielda =

field1.split("_")[-1]

fieldb =

`field1.split("_")[-1]`

I now have field1 with values of A_B_C_D. I need to separate the A_B_C_D into four separate fields using field calculator. fielda = A, fieldb = B, fieldc = C and so on. I'm not sure how to go about this. I basically need to parse the values by the underscore.

Parsing field in field calculator using Python

I have field1 which has a values of "A_B" (example). I created two fields out of this, values to the left of the underscore go in fielda and to the right of the underscore go in fieldb. I used the code below in field calculator to separate them out into two fields.

fielda =

field1.split("_")[-1]

fieldb =

`field1.split("_")[-1]`

I now have field1 with values of A_B_C_D. I need to separate the A_B_C_D into four separate fields using field calculator. fielda = A, fieldb = B, fieldc = C and so on. I'm not sure how to go about this. I basically need to parse the values by the underscore.

Splitting field in ArcGIS field calculator using Python Parser?

I'm using field calculator in ArcGIS Desktop 10.2.1.

I have field1 which has a values of "A_B" (example). I created two fields out of this, values to the left of the underscore go in fielda and to the right of the underscore go in fieldb. I used the code below in field calculator to separate them out into two fields.

fielda =

field1.split("_")[-1]

fieldb =

`field1.split("_")[-1]`

I now have field1 with values of A_B_C_D. I need to separate the A_B_C_D into four separate fields using field calculator. fielda = A, fieldb = B, fieldc = C and so on. I'm not sure how to go about this. I basically need to parse the values by the underscore.

Source Link
Steve
  • 785
  • 10
  • 21

Parsing field in field calculator using Python

I have field1 which has a values of "A_B" (example). I created two fields out of this, values to the left of the underscore go in fielda and to the right of the underscore go in fieldb. I used the code below in field calculator to separate them out into two fields.

fielda =

field1.split("_")[-1]

fieldb =

`field1.split("_")[-1]`

I now have field1 with values of A_B_C_D. I need to separate the A_B_C_D into four separate fields using field calculator. fielda = A, fieldb = B, fieldc = C and so on. I'm not sure how to go about this. I basically need to parse the values by the underscore.