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?

Quotient of Three Dimensional Torus by Permutation on Coordinates

Windows reverting changes made by Linux to FAT32 partion

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

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

Is my company merging branches wrong?

At what point can a confirmation be established between words of similar meaning in context?

When did Britain learn about the American Declaration of Independence?

Why didn't Daenerys' advisers suggest assassinating Cersei?

How do I balance a campaign consisting of four kobold PCs?

How come Arya Stark wasn't hurt by this in Game of Thrones Season 8 Episode 5?

Hotel booking: Why is Agoda much cheaper than booking.com?

on the truth quest vs in the quest for truth

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

Why does the U.S military use mercenaries?

Can a generation ship withstand its own oxygen and daily wear for many thousands of years?

How can I monitor the bulk API limit?

Largest memory peripheral for Sinclair ZX81?

Bookshelves: the intruder

Told to apply for UK visa before other visas, on UK-Spain-etc. visit

Can the Gate spell draw a creature larger that 20 feet in every dimension through the portal it creates?

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

Why is Drogon so much better in battle than Rhaegal and Viserion?

Pedaling at different gear ratios on flat terrain: what's the point?

Show that the characteristic polynomial is the same as the minimal polynomial



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?













5












$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$
















    5












    $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$














      5












      5








      5





      $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 8 hours ago









      Inzo BabariaInzo Babaria

      44729




      44729




















          2 Answers
          2






          active

          oldest

          votes


















          4












          $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
            8 hours ago










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










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


















          2












          $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









            4












            $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
              8 hours ago










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










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















            4












            $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
              8 hours ago










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










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













            4












            4








            4





            $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 8 hours ago

























            answered 8 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
              8 hours ago










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










            • $begingroup$
              Amazing and wonderful !!!
              $endgroup$
              – Inzo Babaria
              5 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
              8 hours ago










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










            • $begingroup$
              Amazing and wonderful !!!
              $endgroup$
              – Inzo Babaria
              5 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
            8 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
            8 hours ago












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




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












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




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











            2












            $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$

















              2












              $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$















                2












                2








                2





                $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 8 hours ago









                J42161217J42161217

                5,270425




                5,270425



























                    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

                    Log på Navigationsmenu

                    Wonderful Copenhagen (sang) Eksterne henvisninger | NavigationsmenurSide på frankloesser.comWonderful Copenhagen

                    Detroit Tigers Spis treści Historia | Skład zespołu | Sukcesy | Członkowie Baseball Hall of Fame | Zastrzeżone numery | Przypisy | Menu nawigacyjneEncyclopedia of Detroit - Detroit TigersTigers Stadium, Detroit, MITigers Timeline 1900sDetroit Tigers Team History & EncyclopediaTigers Timeline 1910s1935 World Series1945 World Series1945 World Series1984 World SeriesComerica Park, Detroit, MI2006 World Series2012 World SeriesDetroit Tigers 40-Man RosterDetroit Tigers Coaching StaffTigers Hall of FamersTigers Retired Numberse