Iteration issue to create a nested dictionary












2















My data looks as followed:



                 Application                       WorkflowStep
0 WF:ACAA-CR (auto) Manager
1 WF:ACAA-CR (auto) Access Responsible
2 WF:ACAA-CR (auto) Automatic
3 WF:ACAA-CR-AccResp (auto) Manager
4 WF:ACAA-CR-AccResp (auto) Access Responsible
5 WF:ACAA-CR-AccResp (auto) Automatic
6 WF:ACAA-CR-IT-AccResp[AUTO] Group
7 WF:ACAA-CR-IT-AccResp[AUTO] Access Responsible
8 WF:ACAA-CR-IT-AccResp[AUTO] Automatic


Additionally to these two columns I want to add a third column showing the sum of all WorkflowStep's.
The dictionary should look like the following (or similiar):



{'WF:ACAA-CR (auto)': 
[{'Workflow': ['Manager', 'Access Responsible','Automatic'], 'Summary': 3}],
'WF:ACAA-CR-AccResp (auto)':
[{'Workflow': ['Manager','Access Responsible','Automatic'], 'Summary': 3}],
'WF:ACAA-CR-IT-AccResp[AUTO]':
[{'Workflow': ['Group','Access Responsible','Automatic'], 'Summary': 3}]
}


My code to create a dictionary out of the two above columns works fine.



for i in range(len(df)):
currentid = df.iloc[i,0]
currentvalue = df.iloc[i,1]
dict.setdefault(currentid, )
dict[currentid].append(currentvalue)


The code to create the sum of the WorkflowStep is as followed and also works fine:



for key, values in dict.items():
val = values
match = ["Manager", "Access Responsible", "Automatic", "Group"]
c = Counter(val)
sumofvalues = 0
for m in match:
if c[m] == 1:
sumofvalues += 1


My initial idea was to adjust my first code where the initial key is the Application and WorkflowStep, Summary would be sub-dictionaries.



for i in range(len(df)):
currentid = df.iloc[i,0]
currentvalue = df.iloc[i,1]
dict.setdefault(currentid, )
dict[currentid].append({"Workflow": [currentvalue], "Summary": })


The result of this is however unsatisfactory because it does not add currentvalue to the already existing Workflow key but recreates them after every iteration.



Example



 {'WF:ACAA-CR (auto)': [{'Workflow': ['Manager'], 'Summary': },
{'Workflow': ['Access Responsible'], 'Summary': },
{'Workflow': ['Automatic'], 'Summary': }]
}


How can I create a dictionary similiar to what I wrote above?










share|improve this question



























    2















    My data looks as followed:



                     Application                       WorkflowStep
    0 WF:ACAA-CR (auto) Manager
    1 WF:ACAA-CR (auto) Access Responsible
    2 WF:ACAA-CR (auto) Automatic
    3 WF:ACAA-CR-AccResp (auto) Manager
    4 WF:ACAA-CR-AccResp (auto) Access Responsible
    5 WF:ACAA-CR-AccResp (auto) Automatic
    6 WF:ACAA-CR-IT-AccResp[AUTO] Group
    7 WF:ACAA-CR-IT-AccResp[AUTO] Access Responsible
    8 WF:ACAA-CR-IT-AccResp[AUTO] Automatic


    Additionally to these two columns I want to add a third column showing the sum of all WorkflowStep's.
    The dictionary should look like the following (or similiar):



    {'WF:ACAA-CR (auto)': 
    [{'Workflow': ['Manager', 'Access Responsible','Automatic'], 'Summary': 3}],
    'WF:ACAA-CR-AccResp (auto)':
    [{'Workflow': ['Manager','Access Responsible','Automatic'], 'Summary': 3}],
    'WF:ACAA-CR-IT-AccResp[AUTO]':
    [{'Workflow': ['Group','Access Responsible','Automatic'], 'Summary': 3}]
    }


    My code to create a dictionary out of the two above columns works fine.



    for i in range(len(df)):
    currentid = df.iloc[i,0]
    currentvalue = df.iloc[i,1]
    dict.setdefault(currentid, )
    dict[currentid].append(currentvalue)


    The code to create the sum of the WorkflowStep is as followed and also works fine:



    for key, values in dict.items():
    val = values
    match = ["Manager", "Access Responsible", "Automatic", "Group"]
    c = Counter(val)
    sumofvalues = 0
    for m in match:
    if c[m] == 1:
    sumofvalues += 1


    My initial idea was to adjust my first code where the initial key is the Application and WorkflowStep, Summary would be sub-dictionaries.



    for i in range(len(df)):
    currentid = df.iloc[i,0]
    currentvalue = df.iloc[i,1]
    dict.setdefault(currentid, )
    dict[currentid].append({"Workflow": [currentvalue], "Summary": })


    The result of this is however unsatisfactory because it does not add currentvalue to the already existing Workflow key but recreates them after every iteration.



    Example



     {'WF:ACAA-CR (auto)': [{'Workflow': ['Manager'], 'Summary': },
    {'Workflow': ['Access Responsible'], 'Summary': },
    {'Workflow': ['Automatic'], 'Summary': }]
    }


    How can I create a dictionary similiar to what I wrote above?










    share|improve this question

























      2












      2








      2








      My data looks as followed:



                       Application                       WorkflowStep
      0 WF:ACAA-CR (auto) Manager
      1 WF:ACAA-CR (auto) Access Responsible
      2 WF:ACAA-CR (auto) Automatic
      3 WF:ACAA-CR-AccResp (auto) Manager
      4 WF:ACAA-CR-AccResp (auto) Access Responsible
      5 WF:ACAA-CR-AccResp (auto) Automatic
      6 WF:ACAA-CR-IT-AccResp[AUTO] Group
      7 WF:ACAA-CR-IT-AccResp[AUTO] Access Responsible
      8 WF:ACAA-CR-IT-AccResp[AUTO] Automatic


      Additionally to these two columns I want to add a third column showing the sum of all WorkflowStep's.
      The dictionary should look like the following (or similiar):



      {'WF:ACAA-CR (auto)': 
      [{'Workflow': ['Manager', 'Access Responsible','Automatic'], 'Summary': 3}],
      'WF:ACAA-CR-AccResp (auto)':
      [{'Workflow': ['Manager','Access Responsible','Automatic'], 'Summary': 3}],
      'WF:ACAA-CR-IT-AccResp[AUTO]':
      [{'Workflow': ['Group','Access Responsible','Automatic'], 'Summary': 3}]
      }


      My code to create a dictionary out of the two above columns works fine.



      for i in range(len(df)):
      currentid = df.iloc[i,0]
      currentvalue = df.iloc[i,1]
      dict.setdefault(currentid, )
      dict[currentid].append(currentvalue)


      The code to create the sum of the WorkflowStep is as followed and also works fine:



      for key, values in dict.items():
      val = values
      match = ["Manager", "Access Responsible", "Automatic", "Group"]
      c = Counter(val)
      sumofvalues = 0
      for m in match:
      if c[m] == 1:
      sumofvalues += 1


      My initial idea was to adjust my first code where the initial key is the Application and WorkflowStep, Summary would be sub-dictionaries.



      for i in range(len(df)):
      currentid = df.iloc[i,0]
      currentvalue = df.iloc[i,1]
      dict.setdefault(currentid, )
      dict[currentid].append({"Workflow": [currentvalue], "Summary": })


      The result of this is however unsatisfactory because it does not add currentvalue to the already existing Workflow key but recreates them after every iteration.



      Example



       {'WF:ACAA-CR (auto)': [{'Workflow': ['Manager'], 'Summary': },
      {'Workflow': ['Access Responsible'], 'Summary': },
      {'Workflow': ['Automatic'], 'Summary': }]
      }


      How can I create a dictionary similiar to what I wrote above?










      share|improve this question














      My data looks as followed:



                       Application                       WorkflowStep
      0 WF:ACAA-CR (auto) Manager
      1 WF:ACAA-CR (auto) Access Responsible
      2 WF:ACAA-CR (auto) Automatic
      3 WF:ACAA-CR-AccResp (auto) Manager
      4 WF:ACAA-CR-AccResp (auto) Access Responsible
      5 WF:ACAA-CR-AccResp (auto) Automatic
      6 WF:ACAA-CR-IT-AccResp[AUTO] Group
      7 WF:ACAA-CR-IT-AccResp[AUTO] Access Responsible
      8 WF:ACAA-CR-IT-AccResp[AUTO] Automatic


      Additionally to these two columns I want to add a third column showing the sum of all WorkflowStep's.
      The dictionary should look like the following (or similiar):



      {'WF:ACAA-CR (auto)': 
      [{'Workflow': ['Manager', 'Access Responsible','Automatic'], 'Summary': 3}],
      'WF:ACAA-CR-AccResp (auto)':
      [{'Workflow': ['Manager','Access Responsible','Automatic'], 'Summary': 3}],
      'WF:ACAA-CR-IT-AccResp[AUTO]':
      [{'Workflow': ['Group','Access Responsible','Automatic'], 'Summary': 3}]
      }


      My code to create a dictionary out of the two above columns works fine.



      for i in range(len(df)):
      currentid = df.iloc[i,0]
      currentvalue = df.iloc[i,1]
      dict.setdefault(currentid, )
      dict[currentid].append(currentvalue)


      The code to create the sum of the WorkflowStep is as followed and also works fine:



      for key, values in dict.items():
      val = values
      match = ["Manager", "Access Responsible", "Automatic", "Group"]
      c = Counter(val)
      sumofvalues = 0
      for m in match:
      if c[m] == 1:
      sumofvalues += 1


      My initial idea was to adjust my first code where the initial key is the Application and WorkflowStep, Summary would be sub-dictionaries.



      for i in range(len(df)):
      currentid = df.iloc[i,0]
      currentvalue = df.iloc[i,1]
      dict.setdefault(currentid, )
      dict[currentid].append({"Workflow": [currentvalue], "Summary": })


      The result of this is however unsatisfactory because it does not add currentvalue to the already existing Workflow key but recreates them after every iteration.



      Example



       {'WF:ACAA-CR (auto)': [{'Workflow': ['Manager'], 'Summary': },
      {'Workflow': ['Access Responsible'], 'Summary': },
      {'Workflow': ['Automatic'], 'Summary': }]
      }


      How can I create a dictionary similiar to what I wrote above?







      python python-3.x dictionary nested






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 3 at 10:09









      Alex_PAlex_P

      3291415




      3291415
























          2 Answers
          2






          active

          oldest

          votes


















          4














          IIUC, here's what can help -



          val = df.groupby('Application')['WorkflowStep'].unique()
          {val.index[i]: [{'WorkflowStep':list(val[i]), 'Summary':len(val[i])}] for i in range(len(val))}


          resulting into,



          {'WF:ACAA-CR (auto)': [{'WorkflowStep': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}],
          'WF:ACAA-CR-AccResp (auto)': [{'WorkflowStep': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}],
          'WF:ACAA-CR-IT-AccResp[AUTO]': [{'WorkflowStep': ['Group', 'Access Responsible', 'Automatic'], 'Summary': 3}]}





          share|improve this answer



















          • 1





            Thank you very much for your great answer!

            – Alex_P
            Jan 3 at 11:47



















          0














          I think meW's answer is a much better way of doing things, and takes advantage of the neat power of dataframe's but for reference, if you wanted to do it the way you were trying, I think this will work:



          # Create the data for testing.
          d = {'Application': ["WF:ACAA-CR (auto)", "WF:ACAA-CR (auto)", "WF:ACAA-CR (auto)",
          "WF:ACAA-CR-AccResp (auto)", "WF:ACAA-CR-AccResp (auto)", "WF:ACAA-CR-AccResp (auto)"],
          'WorkflowStep': ["Manager", "Access Responsible","Automatic","Manager","Access Responsible", "Automatic"]}
          df = pd.DataFrame(d)

          new_dict = dict()
          # Iterate through the rows of the data frame.
          for index, row in df.iterrows():
          # Get the values for the current row.
          current_application_id = row['Application']
          current_workflowstep = row['WorkflowStep']

          # Set the default values if not already set.
          new_dict.setdefault(current_application_id, {'Workflow': , 'Summary' : 0})

          # Add the new values.
          new_dict[current_application_id]['Workflow'].append(current_workflowstep)
          new_dict[current_application_id]['Summary'] += 1

          print(new_dict)


          Which gives an output of:



          {'WF:ACAA-CR (auto)': {'Workflow': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}, 
          'WF:ACAA-CR-AccResp (auto)': {'Workflow': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}}





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54020126%2fiteration-issue-to-create-a-nested-dictionary%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4














            IIUC, here's what can help -



            val = df.groupby('Application')['WorkflowStep'].unique()
            {val.index[i]: [{'WorkflowStep':list(val[i]), 'Summary':len(val[i])}] for i in range(len(val))}


            resulting into,



            {'WF:ACAA-CR (auto)': [{'WorkflowStep': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}],
            'WF:ACAA-CR-AccResp (auto)': [{'WorkflowStep': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}],
            'WF:ACAA-CR-IT-AccResp[AUTO]': [{'WorkflowStep': ['Group', 'Access Responsible', 'Automatic'], 'Summary': 3}]}





            share|improve this answer



















            • 1





              Thank you very much for your great answer!

              – Alex_P
              Jan 3 at 11:47
















            4














            IIUC, here's what can help -



            val = df.groupby('Application')['WorkflowStep'].unique()
            {val.index[i]: [{'WorkflowStep':list(val[i]), 'Summary':len(val[i])}] for i in range(len(val))}


            resulting into,



            {'WF:ACAA-CR (auto)': [{'WorkflowStep': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}],
            'WF:ACAA-CR-AccResp (auto)': [{'WorkflowStep': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}],
            'WF:ACAA-CR-IT-AccResp[AUTO]': [{'WorkflowStep': ['Group', 'Access Responsible', 'Automatic'], 'Summary': 3}]}





            share|improve this answer



















            • 1





              Thank you very much for your great answer!

              – Alex_P
              Jan 3 at 11:47














            4












            4








            4







            IIUC, here's what can help -



            val = df.groupby('Application')['WorkflowStep'].unique()
            {val.index[i]: [{'WorkflowStep':list(val[i]), 'Summary':len(val[i])}] for i in range(len(val))}


            resulting into,



            {'WF:ACAA-CR (auto)': [{'WorkflowStep': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}],
            'WF:ACAA-CR-AccResp (auto)': [{'WorkflowStep': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}],
            'WF:ACAA-CR-IT-AccResp[AUTO]': [{'WorkflowStep': ['Group', 'Access Responsible', 'Automatic'], 'Summary': 3}]}





            share|improve this answer













            IIUC, here's what can help -



            val = df.groupby('Application')['WorkflowStep'].unique()
            {val.index[i]: [{'WorkflowStep':list(val[i]), 'Summary':len(val[i])}] for i in range(len(val))}


            resulting into,



            {'WF:ACAA-CR (auto)': [{'WorkflowStep': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}],
            'WF:ACAA-CR-AccResp (auto)': [{'WorkflowStep': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}],
            'WF:ACAA-CR-IT-AccResp[AUTO]': [{'WorkflowStep': ['Group', 'Access Responsible', 'Automatic'], 'Summary': 3}]}






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 3 at 10:31









            meWmeW

            2,858120




            2,858120








            • 1





              Thank you very much for your great answer!

              – Alex_P
              Jan 3 at 11:47














            • 1





              Thank you very much for your great answer!

              – Alex_P
              Jan 3 at 11:47








            1




            1





            Thank you very much for your great answer!

            – Alex_P
            Jan 3 at 11:47





            Thank you very much for your great answer!

            – Alex_P
            Jan 3 at 11:47













            0














            I think meW's answer is a much better way of doing things, and takes advantage of the neat power of dataframe's but for reference, if you wanted to do it the way you were trying, I think this will work:



            # Create the data for testing.
            d = {'Application': ["WF:ACAA-CR (auto)", "WF:ACAA-CR (auto)", "WF:ACAA-CR (auto)",
            "WF:ACAA-CR-AccResp (auto)", "WF:ACAA-CR-AccResp (auto)", "WF:ACAA-CR-AccResp (auto)"],
            'WorkflowStep': ["Manager", "Access Responsible","Automatic","Manager","Access Responsible", "Automatic"]}
            df = pd.DataFrame(d)

            new_dict = dict()
            # Iterate through the rows of the data frame.
            for index, row in df.iterrows():
            # Get the values for the current row.
            current_application_id = row['Application']
            current_workflowstep = row['WorkflowStep']

            # Set the default values if not already set.
            new_dict.setdefault(current_application_id, {'Workflow': , 'Summary' : 0})

            # Add the new values.
            new_dict[current_application_id]['Workflow'].append(current_workflowstep)
            new_dict[current_application_id]['Summary'] += 1

            print(new_dict)


            Which gives an output of:



            {'WF:ACAA-CR (auto)': {'Workflow': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}, 
            'WF:ACAA-CR-AccResp (auto)': {'Workflow': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}}





            share|improve this answer




























              0














              I think meW's answer is a much better way of doing things, and takes advantage of the neat power of dataframe's but for reference, if you wanted to do it the way you were trying, I think this will work:



              # Create the data for testing.
              d = {'Application': ["WF:ACAA-CR (auto)", "WF:ACAA-CR (auto)", "WF:ACAA-CR (auto)",
              "WF:ACAA-CR-AccResp (auto)", "WF:ACAA-CR-AccResp (auto)", "WF:ACAA-CR-AccResp (auto)"],
              'WorkflowStep': ["Manager", "Access Responsible","Automatic","Manager","Access Responsible", "Automatic"]}
              df = pd.DataFrame(d)

              new_dict = dict()
              # Iterate through the rows of the data frame.
              for index, row in df.iterrows():
              # Get the values for the current row.
              current_application_id = row['Application']
              current_workflowstep = row['WorkflowStep']

              # Set the default values if not already set.
              new_dict.setdefault(current_application_id, {'Workflow': , 'Summary' : 0})

              # Add the new values.
              new_dict[current_application_id]['Workflow'].append(current_workflowstep)
              new_dict[current_application_id]['Summary'] += 1

              print(new_dict)


              Which gives an output of:



              {'WF:ACAA-CR (auto)': {'Workflow': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}, 
              'WF:ACAA-CR-AccResp (auto)': {'Workflow': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}}





              share|improve this answer


























                0












                0








                0







                I think meW's answer is a much better way of doing things, and takes advantage of the neat power of dataframe's but for reference, if you wanted to do it the way you were trying, I think this will work:



                # Create the data for testing.
                d = {'Application': ["WF:ACAA-CR (auto)", "WF:ACAA-CR (auto)", "WF:ACAA-CR (auto)",
                "WF:ACAA-CR-AccResp (auto)", "WF:ACAA-CR-AccResp (auto)", "WF:ACAA-CR-AccResp (auto)"],
                'WorkflowStep': ["Manager", "Access Responsible","Automatic","Manager","Access Responsible", "Automatic"]}
                df = pd.DataFrame(d)

                new_dict = dict()
                # Iterate through the rows of the data frame.
                for index, row in df.iterrows():
                # Get the values for the current row.
                current_application_id = row['Application']
                current_workflowstep = row['WorkflowStep']

                # Set the default values if not already set.
                new_dict.setdefault(current_application_id, {'Workflow': , 'Summary' : 0})

                # Add the new values.
                new_dict[current_application_id]['Workflow'].append(current_workflowstep)
                new_dict[current_application_id]['Summary'] += 1

                print(new_dict)


                Which gives an output of:



                {'WF:ACAA-CR (auto)': {'Workflow': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}, 
                'WF:ACAA-CR-AccResp (auto)': {'Workflow': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}}





                share|improve this answer













                I think meW's answer is a much better way of doing things, and takes advantage of the neat power of dataframe's but for reference, if you wanted to do it the way you were trying, I think this will work:



                # Create the data for testing.
                d = {'Application': ["WF:ACAA-CR (auto)", "WF:ACAA-CR (auto)", "WF:ACAA-CR (auto)",
                "WF:ACAA-CR-AccResp (auto)", "WF:ACAA-CR-AccResp (auto)", "WF:ACAA-CR-AccResp (auto)"],
                'WorkflowStep': ["Manager", "Access Responsible","Automatic","Manager","Access Responsible", "Automatic"]}
                df = pd.DataFrame(d)

                new_dict = dict()
                # Iterate through the rows of the data frame.
                for index, row in df.iterrows():
                # Get the values for the current row.
                current_application_id = row['Application']
                current_workflowstep = row['WorkflowStep']

                # Set the default values if not already set.
                new_dict.setdefault(current_application_id, {'Workflow': , 'Summary' : 0})

                # Add the new values.
                new_dict[current_application_id]['Workflow'].append(current_workflowstep)
                new_dict[current_application_id]['Summary'] += 1

                print(new_dict)


                Which gives an output of:



                {'WF:ACAA-CR (auto)': {'Workflow': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}, 
                'WF:ACAA-CR-AccResp (auto)': {'Workflow': ['Manager', 'Access Responsible', 'Automatic'], 'Summary': 3}}






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 3 at 10:40









                Andrew McDowellAndrew McDowell

                2,0541518




                2,0541518






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • 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%2fstackoverflow.com%2fquestions%2f54020126%2fiteration-issue-to-create-a-nested-dictionary%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

                    Angular Downloading a file using contenturl with Basic Authentication

                    Olmecas

                    Can't read property showImagePicker of undefined in react native iOS