Using DeleteCases with a defined function with two arguments as a patternUsing DeleteCases with multiple AstronomicalData propertiesRemoving some data and replacing them with new onesAdvanced SQL-type select statements (filtering) on DatasetsFiltering outliersHow to remove outliers from dataPattern-matching Function with conditions on arbitrary number of argumentsHow to delete matrix elements where the conditions apply to more than one dimensional elementChange the point size in ListPlotHow do I remove particular $x$ and $y$ values from a list of data points?Cleaning away data points which are enveloped within a function

SFDX Can query Package Installation Status, can we?

How can I get a job without pushing my family's income into a higher tax bracket?

Short story with physics professor who "brings back the dead" (Asimov or Bradbury?)

How could a planet have most of its water in the atmosphere?

Does a wine bottle stopper require tevillah?

Why do we use caret (^) as the symbol for ctrl/control?

For a benzene shown in a skeletal structure, what does a substituent to the center of the ring mean?

Moving the subject of the sentence into a dangling participle

Why is B♯ higher than C♭ in 31-ET?

Besides the up and down quark, what other quarks are present in daily matter around us?

Answer "Justification for travel support" in conference registration form

Why was the battle set up *outside* Winterfell?

Roll Dice to get a random number between 1 and 150

How to give very negative feedback gracefully?

Python password manager

How can I close a gap between my fence and my neighbor's that's on his side of the property line?

What does this colon mean? It is not labeling, it is not ternary operator

Do I have to make someone coauthor if he/she solves a problem in StackExchange, asked by myself, which is later used in my paper?

Is induction neccessary for proving that every injective mapping of a finite set into itself is a mapping onto itself?

Can't remove one character of space in my environment

Airbnb - host wants to reduce rooms, can we get refund?

Catholic vs Protestant Support for Nazism in Germany

Would a 1/1 token with persist dying trigger on death effects a second time?

My ID is expired, can I fly to the Bahamas with my passport?



Using DeleteCases with a defined function with two arguments as a pattern


Using DeleteCases with multiple AstronomicalData propertiesRemoving some data and replacing them with new onesAdvanced SQL-type select statements (filtering) on DatasetsFiltering outliersHow to remove outliers from dataPattern-matching Function with conditions on arbitrary number of argumentsHow to delete matrix elements where the conditions apply to more than one dimensional elementChange the point size in ListPlotHow do I remove particular $x$ and $y$ values from a list of data points?Cleaning away data points which are enveloped within a function













1












$begingroup$


I am trying to manipulate some large datasets in Mathematica. I have plotted the data, and I would like to be able to easily remove points from the dataset, and it's fairly easy to identify the x-values of the points I need to remove. Let's say I need to remove the data point at an x-value of 1.1. To do this, I could do something like this:



BadData[entry_] := MatchQ[entry, 1.1, _?NumberQ]
goodData = DeleteCases[data, _?BadData]


However, I have 6 other data sets, all of which I have to remove different outliers (not at 1.1). I'd like to define a function such as



BadData[entry_, bad_] := MatchQ[entry, bad, _?NumberQ]


because then for bad I can just put whatever the x-value is of the point I need to remove. I tested the function out by figuring out that the data point with 1.1 as the x-value is the 7th in data, and running



BadData[data[[7]], 1.1]


returns True. So I know the function works the way I want it to, even though I know this might not be the "prettiest" way to do this.



What I can't figure out is how to use this version of baddata as a pattern in DeleteCases because I don't know how to specify the second variable, which would be 1.1 for this set. Is this possible with the setup I have currently?










share|improve this question







New contributor




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







$endgroup$







  • 1




    $begingroup$
    Try this: DeleteCases[data, _?(BadData[#, 1.1] &)]
    $endgroup$
    – Anjan Kumar
    1 hour ago
















1












$begingroup$


I am trying to manipulate some large datasets in Mathematica. I have plotted the data, and I would like to be able to easily remove points from the dataset, and it's fairly easy to identify the x-values of the points I need to remove. Let's say I need to remove the data point at an x-value of 1.1. To do this, I could do something like this:



BadData[entry_] := MatchQ[entry, 1.1, _?NumberQ]
goodData = DeleteCases[data, _?BadData]


However, I have 6 other data sets, all of which I have to remove different outliers (not at 1.1). I'd like to define a function such as



BadData[entry_, bad_] := MatchQ[entry, bad, _?NumberQ]


because then for bad I can just put whatever the x-value is of the point I need to remove. I tested the function out by figuring out that the data point with 1.1 as the x-value is the 7th in data, and running



BadData[data[[7]], 1.1]


returns True. So I know the function works the way I want it to, even though I know this might not be the "prettiest" way to do this.



What I can't figure out is how to use this version of baddata as a pattern in DeleteCases because I don't know how to specify the second variable, which would be 1.1 for this set. Is this possible with the setup I have currently?










share|improve this question







New contributor




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







$endgroup$







  • 1




    $begingroup$
    Try this: DeleteCases[data, _?(BadData[#, 1.1] &)]
    $endgroup$
    – Anjan Kumar
    1 hour ago














1












1








1





$begingroup$


I am trying to manipulate some large datasets in Mathematica. I have plotted the data, and I would like to be able to easily remove points from the dataset, and it's fairly easy to identify the x-values of the points I need to remove. Let's say I need to remove the data point at an x-value of 1.1. To do this, I could do something like this:



BadData[entry_] := MatchQ[entry, 1.1, _?NumberQ]
goodData = DeleteCases[data, _?BadData]


However, I have 6 other data sets, all of which I have to remove different outliers (not at 1.1). I'd like to define a function such as



BadData[entry_, bad_] := MatchQ[entry, bad, _?NumberQ]


because then for bad I can just put whatever the x-value is of the point I need to remove. I tested the function out by figuring out that the data point with 1.1 as the x-value is the 7th in data, and running



BadData[data[[7]], 1.1]


returns True. So I know the function works the way I want it to, even though I know this might not be the "prettiest" way to do this.



What I can't figure out is how to use this version of baddata as a pattern in DeleteCases because I don't know how to specify the second variable, which would be 1.1 for this set. Is this possible with the setup I have currently?










share|improve this question







New contributor




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







$endgroup$




I am trying to manipulate some large datasets in Mathematica. I have plotted the data, and I would like to be able to easily remove points from the dataset, and it's fairly easy to identify the x-values of the points I need to remove. Let's say I need to remove the data point at an x-value of 1.1. To do this, I could do something like this:



BadData[entry_] := MatchQ[entry, 1.1, _?NumberQ]
goodData = DeleteCases[data, _?BadData]


However, I have 6 other data sets, all of which I have to remove different outliers (not at 1.1). I'd like to define a function such as



BadData[entry_, bad_] := MatchQ[entry, bad, _?NumberQ]


because then for bad I can just put whatever the x-value is of the point I need to remove. I tested the function out by figuring out that the data point with 1.1 as the x-value is the 7th in data, and running



BadData[data[[7]], 1.1]


returns True. So I know the function works the way I want it to, even though I know this might not be the "prettiest" way to do this.



What I can't figure out is how to use this version of baddata as a pattern in DeleteCases because I don't know how to specify the second variable, which would be 1.1 for this set. Is this possible with the setup I have currently?







list-manipulation pattern-matching filtering dataset argument-patterns






share|improve this question







New contributor




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











share|improve this question







New contributor




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









share|improve this question




share|improve this question






New contributor




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









asked 1 hour ago









nwellsnwells

82




82




New contributor




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





New contributor





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






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







  • 1




    $begingroup$
    Try this: DeleteCases[data, _?(BadData[#, 1.1] &)]
    $endgroup$
    – Anjan Kumar
    1 hour ago













  • 1




    $begingroup$
    Try this: DeleteCases[data, _?(BadData[#, 1.1] &)]
    $endgroup$
    – Anjan Kumar
    1 hour ago








1




1




$begingroup$
Try this: DeleteCases[data, _?(BadData[#, 1.1] &)]
$endgroup$
– Anjan Kumar
1 hour ago





$begingroup$
Try this: DeleteCases[data, _?(BadData[#, 1.1] &)]
$endgroup$
– Anjan Kumar
1 hour ago











2 Answers
2






active

oldest

votes


















1












$begingroup$

You can use an implicit function more explicitly, as



data = 1, 5, 1.1, 6, 2, 7;
BadData[entry_, bad_] := MatchQ[entry, bad, _?NumberQ]
DeleteCases[data, _?(BadData[#, 1.1] &)]



1, 5, 2, 7







share|improve this answer









$endgroup$




















    1












    $begingroup$

    You can also define BadData as a pure function:



    BadData[bad_] := First[#] == bad&


    Then:



    DeleteCases[data, _?(BadData[1.1])]



    1, 5, 2, 7




    Another possibility is:



    BadData[bad_] := EqualTo[bad] @* First





    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
      );



      );






      nwells 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%2fmathematica.stackexchange.com%2fquestions%2f197423%2fusing-deletecases-with-a-defined-function-with-two-arguments-as-a-pattern%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









      1












      $begingroup$

      You can use an implicit function more explicitly, as



      data = 1, 5, 1.1, 6, 2, 7;
      BadData[entry_, bad_] := MatchQ[entry, bad, _?NumberQ]
      DeleteCases[data, _?(BadData[#, 1.1] &)]



      1, 5, 2, 7







      share|improve this answer









      $endgroup$

















        1












        $begingroup$

        You can use an implicit function more explicitly, as



        data = 1, 5, 1.1, 6, 2, 7;
        BadData[entry_, bad_] := MatchQ[entry, bad, _?NumberQ]
        DeleteCases[data, _?(BadData[#, 1.1] &)]



        1, 5, 2, 7







        share|improve this answer









        $endgroup$















          1












          1








          1





          $begingroup$

          You can use an implicit function more explicitly, as



          data = 1, 5, 1.1, 6, 2, 7;
          BadData[entry_, bad_] := MatchQ[entry, bad, _?NumberQ]
          DeleteCases[data, _?(BadData[#, 1.1] &)]



          1, 5, 2, 7







          share|improve this answer









          $endgroup$



          You can use an implicit function more explicitly, as



          data = 1, 5, 1.1, 6, 2, 7;
          BadData[entry_, bad_] := MatchQ[entry, bad, _?NumberQ]
          DeleteCases[data, _?(BadData[#, 1.1] &)]



          1, 5, 2, 7








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 1 hour ago









          KagaratschKagaratsch

          4,94731350




          4,94731350





















              1












              $begingroup$

              You can also define BadData as a pure function:



              BadData[bad_] := First[#] == bad&


              Then:



              DeleteCases[data, _?(BadData[1.1])]



              1, 5, 2, 7




              Another possibility is:



              BadData[bad_] := EqualTo[bad] @* First





              share|improve this answer









              $endgroup$

















                1












                $begingroup$

                You can also define BadData as a pure function:



                BadData[bad_] := First[#] == bad&


                Then:



                DeleteCases[data, _?(BadData[1.1])]



                1, 5, 2, 7




                Another possibility is:



                BadData[bad_] := EqualTo[bad] @* First





                share|improve this answer









                $endgroup$















                  1












                  1








                  1





                  $begingroup$

                  You can also define BadData as a pure function:



                  BadData[bad_] := First[#] == bad&


                  Then:



                  DeleteCases[data, _?(BadData[1.1])]



                  1, 5, 2, 7




                  Another possibility is:



                  BadData[bad_] := EqualTo[bad] @* First





                  share|improve this answer









                  $endgroup$



                  You can also define BadData as a pure function:



                  BadData[bad_] := First[#] == bad&


                  Then:



                  DeleteCases[data, _?(BadData[1.1])]



                  1, 5, 2, 7




                  Another possibility is:



                  BadData[bad_] := EqualTo[bad] @* First






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 1 hour ago









                  Carl WollCarl Woll

                  76.6k3100201




                  76.6k3100201




















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









                      draft saved

                      draft discarded


















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












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











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














                      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%2f197423%2fusing-deletecases-with-a-defined-function-with-two-arguments-as-a-pattern%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年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單