Merging two rows with rounding their first elemntsEfficiently extracting an array subset given a separate arrayMerge two Matrices without DuplicatesHow to pair-up nearest elements from different listsHow to collect elements in one list with the constraints provided in a second listMatching list entries by two values, adding the thirdDuties of Threads accompanied by `#` or a Rule `->`From equality of a list's rows to summation over different elements of a matrixTotal function between two elements of sub_listsforward or backward IntegerDigits in pairs must yield different resultsHow to identify similar sublists in a list and visualize the clusters?

Why do academics prefer Mac/Linux?

What should I wear to go and sign an employment contract?

Why would company (decision makers) wait for someone to retire, rather than lay them off, when their role is no longer needed?

Was Tyrion always a poor strategist?

How to draw pentagram-like shape in Latex?

Working hours and productivity expectations for game artists and programmers

What technology would Dwarves need to forge titanium?

Will this series of events work to drown the Tarrasque?

Why would you put your input amplifier in front of your filtering for an ECG signal?

Save my secrets!

How did Arya not get burned in S8E05, "The Bells"?

Are there any crystals that are theoretically possible, but haven't yet been made?

Why is so much ransomware breakable?

How was the blinking terminal cursor invented?

Is it standard to have the first week's pay indefinitely withheld?

What do you call bracelets you wear around the legs?

What color to choose as "danger" if the main color of my app is red

I recently started my machine learning PhD and I have absolutely no idea what I'm doing

Largest memory peripheral for Sinclair ZX81?

how to create an executable file for an AppleScript?

Why use a retrograde orbit?

Failing students when it might cause them economic ruin

Who is frowning in the sentence "Daisy looked at Tom frowning"?

Parse a C++14 integer literal



Merging two rows with rounding their first elemnts


Efficiently extracting an array subset given a separate arrayMerge two Matrices without DuplicatesHow to pair-up nearest elements from different listsHow to collect elements in one list with the constraints provided in a second listMatching list entries by two values, adding the thirdDuties of Threads accompanied by `#` or a Rule `->`From equality of a list's rows to summation over different elements of a matrixTotal function between two elements of sub_listsforward or backward IntegerDigits in pairs must yield different resultsHow to identify similar sublists in a list and visualize the clusters?













6












$begingroup$


Mathematica shows my data in the below style:



 lst=....
-0.410927, 11, 16, 12, 16, 15, 5, 15, 6,
-0.410927, 9, 14, 10, 14, 13, 7, 13, 8
.....


As I copy the first -0.410927 in another cell, I saw that it is really -0.41092720756334744 and for the second -0.410927, I noticed that it is -0.4109272075633472 in fact. Regards to the other rows in the above and the below positions of these two shown rows, which are presented by ...., how I merge such two rows and have a result as



output=lst=....
-0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 9, 14, 10, 14, 13, 7, 13, 8
.....


In fact, there is no any differences between two -0.410927for more digits than 3.



I have to apply this procedure for other rows considering this fact that all elements have just 3 digits for being important. For instance 1.34267 is not different from 1.34311.



How can I help Mathematica to merge multi rows with very similar first elements. The similarity is gained after rounding values up to 3 digits.










share|improve this question









$endgroup$
















    6












    $begingroup$


    Mathematica shows my data in the below style:



     lst=....
    -0.410927, 11, 16, 12, 16, 15, 5, 15, 6,
    -0.410927, 9, 14, 10, 14, 13, 7, 13, 8
    .....


    As I copy the first -0.410927 in another cell, I saw that it is really -0.41092720756334744 and for the second -0.410927, I noticed that it is -0.4109272075633472 in fact. Regards to the other rows in the above and the below positions of these two shown rows, which are presented by ...., how I merge such two rows and have a result as



    output=lst=....
    -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 9, 14, 10, 14, 13, 7, 13, 8
    .....


    In fact, there is no any differences between two -0.410927for more digits than 3.



    I have to apply this procedure for other rows considering this fact that all elements have just 3 digits for being important. For instance 1.34267 is not different from 1.34311.



    How can I help Mathematica to merge multi rows with very similar first elements. The similarity is gained after rounding values up to 3 digits.










    share|improve this question









    $endgroup$














      6












      6








      6





      $begingroup$


      Mathematica shows my data in the below style:



       lst=....
      -0.410927, 11, 16, 12, 16, 15, 5, 15, 6,
      -0.410927, 9, 14, 10, 14, 13, 7, 13, 8
      .....


      As I copy the first -0.410927 in another cell, I saw that it is really -0.41092720756334744 and for the second -0.410927, I noticed that it is -0.4109272075633472 in fact. Regards to the other rows in the above and the below positions of these two shown rows, which are presented by ...., how I merge such two rows and have a result as



      output=lst=....
      -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 9, 14, 10, 14, 13, 7, 13, 8
      .....


      In fact, there is no any differences between two -0.410927for more digits than 3.



      I have to apply this procedure for other rows considering this fact that all elements have just 3 digits for being important. For instance 1.34267 is not different from 1.34311.



      How can I help Mathematica to merge multi rows with very similar first elements. The similarity is gained after rounding values up to 3 digits.










      share|improve this question









      $endgroup$




      Mathematica shows my data in the below style:



       lst=....
      -0.410927, 11, 16, 12, 16, 15, 5, 15, 6,
      -0.410927, 9, 14, 10, 14, 13, 7, 13, 8
      .....


      As I copy the first -0.410927 in another cell, I saw that it is really -0.41092720756334744 and for the second -0.410927, I noticed that it is -0.4109272075633472 in fact. Regards to the other rows in the above and the below positions of these two shown rows, which are presented by ...., how I merge such two rows and have a result as



      output=lst=....
      -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 9, 14, 10, 14, 13, 7, 13, 8
      .....


      In fact, there is no any differences between two -0.410927for more digits than 3.



      I have to apply this procedure for other rows considering this fact that all elements have just 3 digits for being important. For instance 1.34267 is not different from 1.34311.



      How can I help Mathematica to merge multi rows with very similar first elements. The similarity is gained after rounding values up to 3 digits.







      list-manipulation






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 9 hours ago









      Inzo BabariaInzo Babaria

      45229




      45229




















          2 Answers
          2






          active

          oldest

          votes


















          5












          $begingroup$

          lst = -0.410927, 11, 16, 12, 16, 15, 5, 15, 6,
          -0.41, 11, 16, 12, 16, 15, 5, 15, 6,
          -0.45123, 11, 16, 12, 16, 15, 5, 15, 6,
          -0.410927, 9, 14, 10, 14, 13, 7, 13, 8;

          Values@GroupBy[lst, Round[First@#, .001] &, #[[1, 1]], Join @@ #[[All, 2]] &]



          -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 9, 14, 10,
              14, 13, 7, 13, 8,

          -0.41, 11, 16, 12, 16, 15,
              5, 15, 6,

          -0.45123, 11, 16, 12, 16, 15, 5, 15,
          6




          Values@GroupBy[lst, Round[First@#, .01] &, #[[1, 1]], Join @@ #[[All, 2]] &]



          -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 11, 16, 12,
          16, 15, 5, 15, 6, 9, 14, 10, 14, 13, 7, 13,
          8,

          -0.45123, 11, 16, 12, 16, 15, 5, 15, 6







          share|improve this answer











          $endgroup$








          • 1




            $begingroup$
            Thankxx so much. But a problem: once I write the result as grouped[[1]] I reach -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, -0.410927, 9,14, 10, 14, 13, 7, 13, 8 this out put is not yet merged!
            $endgroup$
            – Inzo Babaria
            9 hours ago










          • $begingroup$
            @Inzo, please see the updated version.
            $endgroup$
            – kglr
            9 hours ago










          • $begingroup$
            Amazing and wonderful !!!
            $endgroup$
            – Inzo Babaria
            7 hours ago


















          3












          $begingroup$

          lst=-0.410927,11,16,12,16,15,5,15,6,-0.41,11,16,12,16,15,5,15,6,-0.45123,11,16,12,16,15,5,15,6,-0.410927,9,14,10,14,13,7,13,8;

          #[[1,1]],Flatten[#[[All,2]],1]&/@Values[GroupBy[lst,SetPrecision[#[[1]],3]&]]



          -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 9, 14, 10,
          14, 13, 7, 13, 8, -0.41, 11, 16, 12, 16, 15,
          5, 15, 6, -0.45123, 11, 16, 12, 16, 15, 5, 15, 6







          share|improve this answer









          $endgroup$













            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "387"
            ;
            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
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f198527%2fmerging-two-rows-with-rounding-their-first-elemnts%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









            5












            $begingroup$

            lst = -0.410927, 11, 16, 12, 16, 15, 5, 15, 6,
            -0.41, 11, 16, 12, 16, 15, 5, 15, 6,
            -0.45123, 11, 16, 12, 16, 15, 5, 15, 6,
            -0.410927, 9, 14, 10, 14, 13, 7, 13, 8;

            Values@GroupBy[lst, Round[First@#, .001] &, #[[1, 1]], Join @@ #[[All, 2]] &]



            -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 9, 14, 10,
                14, 13, 7, 13, 8,

            -0.41, 11, 16, 12, 16, 15,
                5, 15, 6,

            -0.45123, 11, 16, 12, 16, 15, 5, 15,
            6




            Values@GroupBy[lst, Round[First@#, .01] &, #[[1, 1]], Join @@ #[[All, 2]] &]



            -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 11, 16, 12,
            16, 15, 5, 15, 6, 9, 14, 10, 14, 13, 7, 13,
            8,

            -0.45123, 11, 16, 12, 16, 15, 5, 15, 6







            share|improve this answer











            $endgroup$








            • 1




              $begingroup$
              Thankxx so much. But a problem: once I write the result as grouped[[1]] I reach -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, -0.410927, 9,14, 10, 14, 13, 7, 13, 8 this out put is not yet merged!
              $endgroup$
              – Inzo Babaria
              9 hours ago










            • $begingroup$
              @Inzo, please see the updated version.
              $endgroup$
              – kglr
              9 hours ago










            • $begingroup$
              Amazing and wonderful !!!
              $endgroup$
              – Inzo Babaria
              7 hours ago















            5












            $begingroup$

            lst = -0.410927, 11, 16, 12, 16, 15, 5, 15, 6,
            -0.41, 11, 16, 12, 16, 15, 5, 15, 6,
            -0.45123, 11, 16, 12, 16, 15, 5, 15, 6,
            -0.410927, 9, 14, 10, 14, 13, 7, 13, 8;

            Values@GroupBy[lst, Round[First@#, .001] &, #[[1, 1]], Join @@ #[[All, 2]] &]



            -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 9, 14, 10,
                14, 13, 7, 13, 8,

            -0.41, 11, 16, 12, 16, 15,
                5, 15, 6,

            -0.45123, 11, 16, 12, 16, 15, 5, 15,
            6




            Values@GroupBy[lst, Round[First@#, .01] &, #[[1, 1]], Join @@ #[[All, 2]] &]



            -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 11, 16, 12,
            16, 15, 5, 15, 6, 9, 14, 10, 14, 13, 7, 13,
            8,

            -0.45123, 11, 16, 12, 16, 15, 5, 15, 6







            share|improve this answer











            $endgroup$








            • 1




              $begingroup$
              Thankxx so much. But a problem: once I write the result as grouped[[1]] I reach -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, -0.410927, 9,14, 10, 14, 13, 7, 13, 8 this out put is not yet merged!
              $endgroup$
              – Inzo Babaria
              9 hours ago










            • $begingroup$
              @Inzo, please see the updated version.
              $endgroup$
              – kglr
              9 hours ago










            • $begingroup$
              Amazing and wonderful !!!
              $endgroup$
              – Inzo Babaria
              7 hours ago













            5












            5








            5





            $begingroup$

            lst = -0.410927, 11, 16, 12, 16, 15, 5, 15, 6,
            -0.41, 11, 16, 12, 16, 15, 5, 15, 6,
            -0.45123, 11, 16, 12, 16, 15, 5, 15, 6,
            -0.410927, 9, 14, 10, 14, 13, 7, 13, 8;

            Values@GroupBy[lst, Round[First@#, .001] &, #[[1, 1]], Join @@ #[[All, 2]] &]



            -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 9, 14, 10,
                14, 13, 7, 13, 8,

            -0.41, 11, 16, 12, 16, 15,
                5, 15, 6,

            -0.45123, 11, 16, 12, 16, 15, 5, 15,
            6




            Values@GroupBy[lst, Round[First@#, .01] &, #[[1, 1]], Join @@ #[[All, 2]] &]



            -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 11, 16, 12,
            16, 15, 5, 15, 6, 9, 14, 10, 14, 13, 7, 13,
            8,

            -0.45123, 11, 16, 12, 16, 15, 5, 15, 6







            share|improve this answer











            $endgroup$



            lst = -0.410927, 11, 16, 12, 16, 15, 5, 15, 6,
            -0.41, 11, 16, 12, 16, 15, 5, 15, 6,
            -0.45123, 11, 16, 12, 16, 15, 5, 15, 6,
            -0.410927, 9, 14, 10, 14, 13, 7, 13, 8;

            Values@GroupBy[lst, Round[First@#, .001] &, #[[1, 1]], Join @@ #[[All, 2]] &]



            -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 9, 14, 10,
                14, 13, 7, 13, 8,

            -0.41, 11, 16, 12, 16, 15,
                5, 15, 6,

            -0.45123, 11, 16, 12, 16, 15, 5, 15,
            6




            Values@GroupBy[lst, Round[First@#, .01] &, #[[1, 1]], Join @@ #[[All, 2]] &]



            -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 11, 16, 12,
            16, 15, 5, 15, 6, 9, 14, 10, 14, 13, 7, 13,
            8,

            -0.45123, 11, 16, 12, 16, 15, 5, 15, 6








            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 9 hours ago

























            answered 9 hours ago









            kglrkglr

            192k10214434




            192k10214434







            • 1




              $begingroup$
              Thankxx so much. But a problem: once I write the result as grouped[[1]] I reach -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, -0.410927, 9,14, 10, 14, 13, 7, 13, 8 this out put is not yet merged!
              $endgroup$
              – Inzo Babaria
              9 hours ago










            • $begingroup$
              @Inzo, please see the updated version.
              $endgroup$
              – kglr
              9 hours ago










            • $begingroup$
              Amazing and wonderful !!!
              $endgroup$
              – Inzo Babaria
              7 hours ago












            • 1




              $begingroup$
              Thankxx so much. But a problem: once I write the result as grouped[[1]] I reach -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, -0.410927, 9,14, 10, 14, 13, 7, 13, 8 this out put is not yet merged!
              $endgroup$
              – Inzo Babaria
              9 hours ago










            • $begingroup$
              @Inzo, please see the updated version.
              $endgroup$
              – kglr
              9 hours ago










            • $begingroup$
              Amazing and wonderful !!!
              $endgroup$
              – Inzo Babaria
              7 hours ago







            1




            1




            $begingroup$
            Thankxx so much. But a problem: once I write the result as grouped[[1]] I reach -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, -0.410927, 9,14, 10, 14, 13, 7, 13, 8 this out put is not yet merged!
            $endgroup$
            – Inzo Babaria
            9 hours ago




            $begingroup$
            Thankxx so much. But a problem: once I write the result as grouped[[1]] I reach -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, -0.410927, 9,14, 10, 14, 13, 7, 13, 8 this out put is not yet merged!
            $endgroup$
            – Inzo Babaria
            9 hours ago












            $begingroup$
            @Inzo, please see the updated version.
            $endgroup$
            – kglr
            9 hours ago




            $begingroup$
            @Inzo, please see the updated version.
            $endgroup$
            – kglr
            9 hours ago












            $begingroup$
            Amazing and wonderful !!!
            $endgroup$
            – Inzo Babaria
            7 hours ago




            $begingroup$
            Amazing and wonderful !!!
            $endgroup$
            – Inzo Babaria
            7 hours ago











            3












            $begingroup$

            lst=-0.410927,11,16,12,16,15,5,15,6,-0.41,11,16,12,16,15,5,15,6,-0.45123,11,16,12,16,15,5,15,6,-0.410927,9,14,10,14,13,7,13,8;

            #[[1,1]],Flatten[#[[All,2]],1]&/@Values[GroupBy[lst,SetPrecision[#[[1]],3]&]]



            -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 9, 14, 10,
            14, 13, 7, 13, 8, -0.41, 11, 16, 12, 16, 15,
            5, 15, 6, -0.45123, 11, 16, 12, 16, 15, 5, 15, 6







            share|improve this answer









            $endgroup$

















              3












              $begingroup$

              lst=-0.410927,11,16,12,16,15,5,15,6,-0.41,11,16,12,16,15,5,15,6,-0.45123,11,16,12,16,15,5,15,6,-0.410927,9,14,10,14,13,7,13,8;

              #[[1,1]],Flatten[#[[All,2]],1]&/@Values[GroupBy[lst,SetPrecision[#[[1]],3]&]]



              -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 9, 14, 10,
              14, 13, 7, 13, 8, -0.41, 11, 16, 12, 16, 15,
              5, 15, 6, -0.45123, 11, 16, 12, 16, 15, 5, 15, 6







              share|improve this answer









              $endgroup$















                3












                3








                3





                $begingroup$

                lst=-0.410927,11,16,12,16,15,5,15,6,-0.41,11,16,12,16,15,5,15,6,-0.45123,11,16,12,16,15,5,15,6,-0.410927,9,14,10,14,13,7,13,8;

                #[[1,1]],Flatten[#[[All,2]],1]&/@Values[GroupBy[lst,SetPrecision[#[[1]],3]&]]



                -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 9, 14, 10,
                14, 13, 7, 13, 8, -0.41, 11, 16, 12, 16, 15,
                5, 15, 6, -0.45123, 11, 16, 12, 16, 15, 5, 15, 6







                share|improve this answer









                $endgroup$



                lst=-0.410927,11,16,12,16,15,5,15,6,-0.41,11,16,12,16,15,5,15,6,-0.45123,11,16,12,16,15,5,15,6,-0.410927,9,14,10,14,13,7,13,8;

                #[[1,1]],Flatten[#[[All,2]],1]&/@Values[GroupBy[lst,SetPrecision[#[[1]],3]&]]



                -0.410927, 11, 16, 12, 16, 15, 5, 15, 6, 9, 14, 10,
                14, 13, 7, 13, 8, -0.41, 11, 16, 12, 16, 15,
                5, 15, 6, -0.45123, 11, 16, 12, 16, 15, 5, 15, 6








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 9 hours ago









                J42161217J42161217

                5,280425




                5,280425



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Mathematica 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.

                    Use MathJax to format equations. MathJax reference.


                    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%2fmathematica.stackexchange.com%2fquestions%2f198527%2fmerging-two-rows-with-rounding-their-first-elemnts%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

                    Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                    Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                    199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單