Help splitting string ID code into various partsSelect polygons contained inside a polygon and assign IDHow...

How to deal with a cynical class?

I need to drive a 7/16" nut but am unsure how to use the socket I bought for my screwdriver

How do I hide Chekhov's Gun?

How to explain that I do not want to visit a country due to personal safety concern?

Is having access to past exams cheating and, if yes, could it be proven just by a good grade?

Is it normal that my co-workers at a fitness company criticize my food choices?

Does this AnyDice function accurately calculate the number of ogres you make unconcious with three 4th-level castings of Sleep?

Making a sword in the stone, in a medieval world without magic

Why are the outputs of printf and std::cout different

Could the Saturn V actually have launched astronauts around Venus?

Rules about breaking the rules. How do I do it well?

Dot in front of file

Sword in the Stone story where the sword was held in place by electromagnets

My story is written in English, but is set in my home country. What language should I use for the dialogue?

RegionDifference for Cylinder and Cuboid

Happy pi day, everyone!

What options are left, if Britain cannot decide?

Ban on all campaign finance?

Welcoming 2019 Pi day: How to draw the letter π?

An Accountant Seeks the Help of a Mathematician

Can the damage from a Talisman of Pure Good (or Ultimate Evil) be non-lethal?

Meaning of "SEVERA INDEOVI VAS" from 3rd Century slab

Did CPM support custom hardware using device drivers?

It's a yearly task, alright



Help splitting string ID code into various parts


Select polygons contained inside a polygon and assign IDHow to place points along a line in a specific offset using python / arcpy?Help with formatting ArcGIS text elements with PythonAssigning a vector to a field in feature class (UpdateCursor)Splitting string column into 2 columns in Python?Find the first occurrence of any letter in an alphanumeric stringHow can I convert Bing's “quadtree” tile addresses to ZXY tile addresses in Python?Address Prefix Strip Using PythonPython code help for ArcGIS Field calculator?Overlay two linestring objects in geopandas, accounting for the attributes













0















I have a series of identification codes that I need to split out. The format of these codes is [region(letter)][district(number)] - [place(number)][subdistrict(letter)]. An example of a some codes include S22-201, TT100-12, and V6-1B. Often there is no subdistrict, and all points fall within the same larger district (so no As or Cs or whatever at the end of the string.



I do not know python very well, but have done by best to search around for relevant code to accomplish this, but have had very little luck. I can do parts of it, like splitting at the hyphen...



!Original_ID!.split('-')[0]


and then extracting the district...



!Split_ID![1:3]


But it seems like two steps for this is unnecessary, and only works when I know the specific number of characters in the string, which isn't realistic for a large data set. I'd like to be able to grab each peace at once: letters on the left of the hyphen, numbers on the left of the hyphen, numbers on the right of the hyphen, and letters (if any) on the right of the hyphen. I'd need the numeric fields to be integers (or I guess possibly floats in some rare cases maybe).



Thanks in advance if anyone has suggestions.









share







New contributor




vce500 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I have a series of identification codes that I need to split out. The format of these codes is [region(letter)][district(number)] - [place(number)][subdistrict(letter)]. An example of a some codes include S22-201, TT100-12, and V6-1B. Often there is no subdistrict, and all points fall within the same larger district (so no As or Cs or whatever at the end of the string.



    I do not know python very well, but have done by best to search around for relevant code to accomplish this, but have had very little luck. I can do parts of it, like splitting at the hyphen...



    !Original_ID!.split('-')[0]


    and then extracting the district...



    !Split_ID![1:3]


    But it seems like two steps for this is unnecessary, and only works when I know the specific number of characters in the string, which isn't realistic for a large data set. I'd like to be able to grab each peace at once: letters on the left of the hyphen, numbers on the left of the hyphen, numbers on the right of the hyphen, and letters (if any) on the right of the hyphen. I'd need the numeric fields to be integers (or I guess possibly floats in some rare cases maybe).



    Thanks in advance if anyone has suggestions.









    share







    New contributor




    vce500 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I have a series of identification codes that I need to split out. The format of these codes is [region(letter)][district(number)] - [place(number)][subdistrict(letter)]. An example of a some codes include S22-201, TT100-12, and V6-1B. Often there is no subdistrict, and all points fall within the same larger district (so no As or Cs or whatever at the end of the string.



      I do not know python very well, but have done by best to search around for relevant code to accomplish this, but have had very little luck. I can do parts of it, like splitting at the hyphen...



      !Original_ID!.split('-')[0]


      and then extracting the district...



      !Split_ID![1:3]


      But it seems like two steps for this is unnecessary, and only works when I know the specific number of characters in the string, which isn't realistic for a large data set. I'd like to be able to grab each peace at once: letters on the left of the hyphen, numbers on the left of the hyphen, numbers on the right of the hyphen, and letters (if any) on the right of the hyphen. I'd need the numeric fields to be integers (or I guess possibly floats in some rare cases maybe).



      Thanks in advance if anyone has suggestions.









      share







      New contributor




      vce500 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I have a series of identification codes that I need to split out. The format of these codes is [region(letter)][district(number)] - [place(number)][subdistrict(letter)]. An example of a some codes include S22-201, TT100-12, and V6-1B. Often there is no subdistrict, and all points fall within the same larger district (so no As or Cs or whatever at the end of the string.



      I do not know python very well, but have done by best to search around for relevant code to accomplish this, but have had very little luck. I can do parts of it, like splitting at the hyphen...



      !Original_ID!.split('-')[0]


      and then extracting the district...



      !Split_ID![1:3]


      But it seems like two steps for this is unnecessary, and only works when I know the specific number of characters in the string, which isn't realistic for a large data set. I'd like to be able to grab each peace at once: letters on the left of the hyphen, numbers on the left of the hyphen, numbers on the right of the hyphen, and letters (if any) on the right of the hyphen. I'd need the numeric fields to be integers (or I guess possibly floats in some rare cases maybe).



      Thanks in advance if anyone has suggestions.







      python arcmap field-calculator





      share







      New contributor




      vce500 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      vce500 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      vce500 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 9 mins ago









      vce500vce500

      11




      11




      New contributor




      vce500 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      vce500 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      vce500 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "79"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          vce500 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f315591%2fhelp-splitting-string-id-code-into-various-parts%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          vce500 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          vce500 is a new contributor. Be nice, and check out our Code of Conduct.













          vce500 is a new contributor. Be nice, and check out our Code of Conduct.












          vce500 is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f315591%2fhelp-splitting-string-id-code-into-various-parts%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Щит и меч (фильм) Содержание Названия серий | Сюжет |...

          Венесуэла на летних Олимпийских играх 2000 Содержание Состав...

          Meter-Bus Содержание Параметры шины | Стандартизация |...