How to remove from the data the rows of with fixed number of elements? [on hold]












3












$begingroup$


Consider the data which has the form



data = {{x1,y1,z1},{x2,y2,z2,t2},{x3,y4,z4,t4},{x5,y5,z5},...}


How to remove the rows containing three elements from the data?



I.e., to obtain



dataprime = {{x2,y2,z2,t2},{x3,y4,z4,t4},...}









share|improve this question











$endgroup$



put on hold as off-topic by MarcoB, LCarvalho, Henrik Schumacher, J. M. is computer-less 1 hour ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, LCarvalho, Henrik Schumacher, J. M. is computer-less

If this question can be reworded to fit the rules in the help center, please edit the question.












  • 1




    $begingroup$
    Maybe you ask for DeleteCases[data, _?(Length[#] == 3 &)]...
    $endgroup$
    – Henrik Schumacher
    11 hours ago










  • $begingroup$
    @HenrikSchumacher : sorry, already corrected this.
    $endgroup$
    – John Taylor
    11 hours ago
















3












$begingroup$


Consider the data which has the form



data = {{x1,y1,z1},{x2,y2,z2,t2},{x3,y4,z4,t4},{x5,y5,z5},...}


How to remove the rows containing three elements from the data?



I.e., to obtain



dataprime = {{x2,y2,z2,t2},{x3,y4,z4,t4},...}









share|improve this question











$endgroup$



put on hold as off-topic by MarcoB, LCarvalho, Henrik Schumacher, J. M. is computer-less 1 hour ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, LCarvalho, Henrik Schumacher, J. M. is computer-less

If this question can be reworded to fit the rules in the help center, please edit the question.












  • 1




    $begingroup$
    Maybe you ask for DeleteCases[data, _?(Length[#] == 3 &)]...
    $endgroup$
    – Henrik Schumacher
    11 hours ago










  • $begingroup$
    @HenrikSchumacher : sorry, already corrected this.
    $endgroup$
    – John Taylor
    11 hours ago














3












3








3


1



$begingroup$


Consider the data which has the form



data = {{x1,y1,z1},{x2,y2,z2,t2},{x3,y4,z4,t4},{x5,y5,z5},...}


How to remove the rows containing three elements from the data?



I.e., to obtain



dataprime = {{x2,y2,z2,t2},{x3,y4,z4,t4},...}









share|improve this question











$endgroup$




Consider the data which has the form



data = {{x1,y1,z1},{x2,y2,z2,t2},{x3,y4,z4,t4},{x5,y5,z5},...}


How to remove the rows containing three elements from the data?



I.e., to obtain



dataprime = {{x2,y2,z2,t2},{x3,y4,z4,t4},...}






list-manipulation filtering






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago









J. M. is computer-less

97k10303463




97k10303463










asked 11 hours ago









John TaylorJohn Taylor

736211




736211




put on hold as off-topic by MarcoB, LCarvalho, Henrik Schumacher, J. M. is computer-less 1 hour ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, LCarvalho, Henrik Schumacher, J. M. is computer-less

If this question can be reworded to fit the rules in the help center, please edit the question.







put on hold as off-topic by MarcoB, LCarvalho, Henrik Schumacher, J. M. is computer-less 1 hour ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, LCarvalho, Henrik Schumacher, J. M. is computer-less

If this question can be reworded to fit the rules in the help center, please edit the question.








  • 1




    $begingroup$
    Maybe you ask for DeleteCases[data, _?(Length[#] == 3 &)]...
    $endgroup$
    – Henrik Schumacher
    11 hours ago










  • $begingroup$
    @HenrikSchumacher : sorry, already corrected this.
    $endgroup$
    – John Taylor
    11 hours ago














  • 1




    $begingroup$
    Maybe you ask for DeleteCases[data, _?(Length[#] == 3 &)]...
    $endgroup$
    – Henrik Schumacher
    11 hours ago










  • $begingroup$
    @HenrikSchumacher : sorry, already corrected this.
    $endgroup$
    – John Taylor
    11 hours ago








1




1




$begingroup$
Maybe you ask for DeleteCases[data, _?(Length[#] == 3 &)]...
$endgroup$
– Henrik Schumacher
11 hours ago




$begingroup$
Maybe you ask for DeleteCases[data, _?(Length[#] == 3 &)]...
$endgroup$
– Henrik Schumacher
11 hours ago












$begingroup$
@HenrikSchumacher : sorry, already corrected this.
$endgroup$
– John Taylor
11 hours ago




$begingroup$
@HenrikSchumacher : sorry, already corrected this.
$endgroup$
– John Taylor
11 hours ago










2 Answers
2






active

oldest

votes


















8












$begingroup$

Any one of these would do:



Cases[data, Except[_?(Length[#] == 3 &)]]
DeleteCases[data, _?(Length[#] == 3 &)]

Select[data, Length[#] != 3 &]

Delete[data, Position[data, _?(Length[#] == 3 &)]]

data /. {_, _, _} -> Nothing
data /. {Repeated[_, {3}]} -> Nothing


They all return: {{x2, y2, z2, t2}, {x3, y4, z4, t4}}






share|improve this answer











$endgroup$





















    5












    $begingroup$

    Also



    Pick[data, Unitize[-3 + Length /@ data], 1]





    share|improve this answer









    $endgroup$




















      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      8












      $begingroup$

      Any one of these would do:



      Cases[data, Except[_?(Length[#] == 3 &)]]
      DeleteCases[data, _?(Length[#] == 3 &)]

      Select[data, Length[#] != 3 &]

      Delete[data, Position[data, _?(Length[#] == 3 &)]]

      data /. {_, _, _} -> Nothing
      data /. {Repeated[_, {3}]} -> Nothing


      They all return: {{x2, y2, z2, t2}, {x3, y4, z4, t4}}






      share|improve this answer











      $endgroup$


















        8












        $begingroup$

        Any one of these would do:



        Cases[data, Except[_?(Length[#] == 3 &)]]
        DeleteCases[data, _?(Length[#] == 3 &)]

        Select[data, Length[#] != 3 &]

        Delete[data, Position[data, _?(Length[#] == 3 &)]]

        data /. {_, _, _} -> Nothing
        data /. {Repeated[_, {3}]} -> Nothing


        They all return: {{x2, y2, z2, t2}, {x3, y4, z4, t4}}






        share|improve this answer











        $endgroup$
















          8












          8








          8





          $begingroup$

          Any one of these would do:



          Cases[data, Except[_?(Length[#] == 3 &)]]
          DeleteCases[data, _?(Length[#] == 3 &)]

          Select[data, Length[#] != 3 &]

          Delete[data, Position[data, _?(Length[#] == 3 &)]]

          data /. {_, _, _} -> Nothing
          data /. {Repeated[_, {3}]} -> Nothing


          They all return: {{x2, y2, z2, t2}, {x3, y4, z4, t4}}






          share|improve this answer











          $endgroup$



          Any one of these would do:



          Cases[data, Except[_?(Length[#] == 3 &)]]
          DeleteCases[data, _?(Length[#] == 3 &)]

          Select[data, Length[#] != 3 &]

          Delete[data, Position[data, _?(Length[#] == 3 &)]]

          data /. {_, _, _} -> Nothing
          data /. {Repeated[_, {3}]} -> Nothing


          They all return: {{x2, y2, z2, t2}, {x3, y4, z4, t4}}







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 10 hours ago

























          answered 11 hours ago









          MarcoBMarcoB

          36.3k556112




          36.3k556112























              5












              $begingroup$

              Also



              Pick[data, Unitize[-3 + Length /@ data], 1]





              share|improve this answer









              $endgroup$


















                5












                $begingroup$

                Also



                Pick[data, Unitize[-3 + Length /@ data], 1]





                share|improve this answer









                $endgroup$
















                  5












                  5








                  5





                  $begingroup$

                  Also



                  Pick[data, Unitize[-3 + Length /@ data], 1]





                  share|improve this answer









                  $endgroup$



                  Also



                  Pick[data, Unitize[-3 + Length /@ data], 1]






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 11 hours ago









                  kglrkglr

                  186k10202421




                  186k10202421















                      Popular posts from this blog

                      If I really need a card on my start hand, how many mulligans make sense? [duplicate]

                      Alcedinidae

                      Can an atomic nucleus contain both particles and antiparticles? [duplicate]