{"id":3306,"date":"2023-07-18T04:22:57","date_gmt":"2023-07-18T04:22:57","guid":{"rendered":"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/"},"modified":"2023-07-18T04:22:57","modified_gmt":"2023-07-18T04:22:57","slug":"pandas-serie-nach-wert-filtern","status":"publish","type":"post","link":"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/","title":{"rendered":"Pandas: so filtern sie serien nach wert"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Sie k\u00f6nnen die folgenden Methoden verwenden, um Werte in einer Pandas-Reihe zu filtern:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Methode 1: Filtern Sie Werte basierend auf einer einzelnen Bedingung<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#filter for values equal to 7<\/span>\nmy_series. <span style=\"color: #3366ff;\">loc<\/span> [ <span style=\"color: #008000;\">lambda<\/span> x:x == 7]\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><strong>Methode 2: Werte mithilfe der \u201eOR\u201c-Bedingung filtern<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#filter for values less than 10 <em>or<\/em> greater than 20<\/span>\nmy_series. <span style=\"color: #3366ff;\">loc<\/span> [ <span style=\"color: #008000;\">lambda<\/span> x: (x &lt; 10) | (x &gt; 20)]\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><strong>Methode 3: Werte mithilfe der \u201eAND\u201c-Bedingung filtern<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#filter for values greater than 10 <i>and<\/i> less than 20<\/span>\nmy_series. <span style=\"color: #3366ff;\">loc<\/span> [ <span style=\"color: #008000;\">lambda<\/span> x: (x &gt; 10) &amp; (x &lt; 20)] \n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><strong>Methode 4: Filtern Sie die in der Liste enthaltenen Werte<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#filter for values that are equal to 4, 7, or 23<\/span>\nmy_series[my_series. <span style=\"color: #3366ff;\">isin<\/span> ([4, 7, 23])]\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">In diesem Tutorial wird erkl\u00e4rt, wie Sie die einzelnen Methoden in der Praxis mit der folgenden Pandas-Serie anwenden:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008000;\">import<\/span> pandas <span style=\"color: #008000;\">as<\/span> pd\n\n<span style=\"color: #008080;\">#create pandas Series\n<\/span>data = pd. <span style=\"color: #3366ff;\">Series<\/span> ([4, 7, 7, 12, 19, 23, 25, 30])\n\n<span style=\"color: #008080;\">#view pandas Series\n<\/span><span style=\"color: #008000;\">print<\/span> (data)\n\n0 4\n1 7\n2 7\n3 12\n4 19\n5 23\n6 25\n7 30\ndtype: int64<\/strong><\/span><\/pre>\n<h2> <span style=\"color: #000000;\"><strong>Beispiel 1: Werte basierend auf einer Bedingung filtern<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Der folgende Code zeigt, wie die Pandas-Reihe nach Werten gleich 7 gefiltert wird:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#filter for values equal to 7\n<\/span>data. <span style=\"color: #3366ff;\">loc<\/span> [ <span style=\"color: #008000;\">lambda<\/span> x:x == 7]\n\n1 7\n2 7\ndtype: int64<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Wir k\u00f6nnen auch Werte <strong>ungleich<\/strong> 7 filtern:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#filter for values not equal to 7\n<\/span>data. <span style=\"color: #3366ff;\">loc<\/span> [ <span style=\"color: #008000;\">lambda<\/span> x:x != 7]\n\n0 4\n3 12\n4 19\n5 23\n6 25\n7 30\ndtype: int644<\/strong><\/pre>\n<h2> <span style=\"color: #000000;\"><strong>Beispiel 2: Filtern Sie Werte mithilfe der \u201eOR\u201c-Bedingung<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Der folgende Code zeigt, wie die Pandas-Reihe nach Werten kleiner als 10 <strong>oder<\/strong> gr\u00f6\u00dfer als 20 gefiltert wird:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#filter for values less than 10 <em>or<\/em> greater than 20<\/span>\ndata. <span style=\"color: #3366ff;\">loc<\/span> [ <span style=\"color: #008000;\">lambda<\/span> x: (x &lt; 10) | (x &gt; 20)]\n\n0 4\n1 7\n2 7\n5 23\n6 25\n7 30\ndtype: int64<\/strong><\/pre>\n<h2> <span style=\"color: #000000;\"><strong>Beispiel 3: Filtern Sie Werte mithilfe der \u201eAND\u201c-Bedingung<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Der folgende Code zeigt, wie die Pandas-Reihe nach Werten gr\u00f6\u00dfer als 10 <strong>und<\/strong> kleiner als 20 gefiltert wird:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#filter for values greater than 10 <i>and<\/i> less than 20<\/span>\ndata. <span style=\"color: #3366ff;\">loc<\/span> [ <span style=\"color: #008000;\">lambda<\/span> x: (x &gt; 10) &amp; (x &lt; 20)]\n\n3 12\n4 19\ndtype: int64<\/strong><\/pre>\n<h2> <span style=\"color: #000000;\"><strong>Beispiel 4: Filtern Sie die in der Liste enthaltenen Werte<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Der folgende Code zeigt, wie die Pandas-Reihe nach in einer Liste enthaltenen Werten gefiltert wird:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#filter for values that are equal to 4, 7, or 23<\/span>\ndata[data. <span style=\"color: #3366ff;\">isin<\/span> ([4, 7, 23])]\n\n0 4\n1 7\n2 7\n5 23\ndtype: int64\n<\/strong><\/pre>\n<h2> <span style=\"color: #000000;\"><strong>Zus\u00e4tzliche Ressourcen<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">In den folgenden Tutorials wird erl\u00e4utert, wie Sie andere g\u00e4ngige Filtervorg\u00e4nge in Python durchf\u00fchren:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/de\/pandas-filtern-zeilen-die-zeichenfolgen-enthalten\/\" target=\"_blank\" rel=\"noopener\">So filtern Sie Pandas DataFrame-Zeilen, die eine bestimmte Zeichenfolge enthalten<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/pandas-filtern-mehrere-bedingungen\/\" target=\"_blank\" rel=\"noopener\">So filtern Sie einen Pandas DataFrame nach mehreren Bedingungen<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/fehlende-pandas\/\" target=\"_blank\" rel=\"noopener\">So verwenden Sie den \u201eNOT IN\u201c-Filter in Pandas DataFrame<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sie k\u00f6nnen die folgenden Methoden verwenden, um Werte in einer Pandas-Reihe zu filtern: Methode 1: Filtern Sie Werte basierend auf einer einzelnen Bedingung #filter for values equal to 7 my_series. loc [ lambda x:x == 7] Methode 2: Werte mithilfe der \u201eOR\u201c-Bedingung filtern #filter for values less than 10 or greater than 20 my_series. loc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Pandas: So filtern Sie Serien nach Wert \u2013 Statorials<\/title>\n<meta name=\"description\" content=\"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie eine Pandas-Reihe nach Wert gefiltert wird.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pandas: So filtern Sie Serien nach Wert \u2013 Statorials\" \/>\n<meta property=\"og:description\" content=\"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie eine Pandas-Reihe nach Wert gefiltert wird.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-18T04:22:57+00:00\" \/>\n<meta name=\"author\" content=\"Dr. Benjamin Anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr. Benjamin Anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/\",\"url\":\"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/\",\"name\":\"Pandas: So filtern Sie Serien nach Wert \u2013 Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/de\/#website\"},\"datePublished\":\"2023-07-18T04:22:57+00:00\",\"dateModified\":\"2023-07-18T04:22:57+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\"},\"description\":\"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie eine Pandas-Reihe nach Wert gefiltert wird.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/#breadcrumb\"},\"inLanguage\":\"de-DE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Heim\",\"item\":\"https:\/\/statorials.org\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Pandas: so filtern sie serien nach wert\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/de\/#website\",\"url\":\"https:\/\/statorials.org\/de\/\",\"name\":\"Statorials\",\"description\":\"Ihr Leitfaden f\u00fcr statistische Kompetenz !\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/de\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de-DE\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\",\"name\":\"Dr. Benjamin Anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de-DE\",\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr. Benjamin Anderson\"},\"description\":\"Hallo, ich bin Benjamin, ein pensionierter Statistikprofessor, der sich zum engagierten Statorials-Lehrer entwickelt hat. Mit umfassender Erfahrung und Fachwissen auf dem Gebiet der Statistik bin ich bestrebt, mein Wissen zu teilen, um Studenten durch Statorials zu bef\u00e4higen. Mehr wissen\",\"sameAs\":[\"https:\/\/statorials.org\/de\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pandas: So filtern Sie Serien nach Wert \u2013 Statorials","description":"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie eine Pandas-Reihe nach Wert gefiltert wird.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/","og_locale":"de_DE","og_type":"article","og_title":"Pandas: So filtern Sie Serien nach Wert \u2013 Statorials","og_description":"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie eine Pandas-Reihe nach Wert gefiltert wird.","og_url":"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/","og_site_name":"Statorials","article_published_time":"2023-07-18T04:22:57+00:00","author":"Dr. Benjamin Anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr. Benjamin Anderson","Gesch\u00e4tzte Lesezeit":"2 Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/","url":"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/","name":"Pandas: So filtern Sie Serien nach Wert \u2013 Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/de\/#website"},"datePublished":"2023-07-18T04:22:57+00:00","dateModified":"2023-07-18T04:22:57+00:00","author":{"@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0"},"description":"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie eine Pandas-Reihe nach Wert gefiltert wird.","breadcrumb":{"@id":"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/#breadcrumb"},"inLanguage":"de-DE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/de\/pandas-serie-nach-wert-filtern\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Heim","item":"https:\/\/statorials.org\/de\/"},{"@type":"ListItem","position":2,"name":"Pandas: so filtern sie serien nach wert"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/de\/#website","url":"https:\/\/statorials.org\/de\/","name":"Statorials","description":"Ihr Leitfaden f\u00fcr statistische Kompetenz !","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/de\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de-DE"},{"@type":"Person","@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0","name":"Dr. Benjamin Anderson","image":{"@type":"ImageObject","inLanguage":"de-DE","@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg","caption":"Dr. Benjamin Anderson"},"description":"Hallo, ich bin Benjamin, ein pensionierter Statistikprofessor, der sich zum engagierten Statorials-Lehrer entwickelt hat. Mit umfassender Erfahrung und Fachwissen auf dem Gebiet der Statistik bin ich bestrebt, mein Wissen zu teilen, um Studenten durch Statorials zu bef\u00e4higen. Mehr wissen","sameAs":["https:\/\/statorials.org\/de"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/3306"}],"collection":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/comments?post=3306"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/3306\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/media?parent=3306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/categories?post=3306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/tags?post=3306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}