{"id":2334,"date":"2023-07-22T17:32:44","date_gmt":"2023-07-22T17:32:44","guid":{"rendered":"https:\/\/statorials.org\/de\/numpy-fugt-der-matrix-eine-zeile-hinzu\/"},"modified":"2023-07-22T17:32:44","modified_gmt":"2023-07-22T17:32:44","slug":"numpy-fugt-der-matrix-eine-zeile-hinzu","status":"publish","type":"post","link":"https:\/\/statorials.org\/de\/numpy-fugt-der-matrix-eine-zeile-hinzu\/","title":{"rendered":"So f\u00fcgen sie einer matrix in numpy eine zeile hinzu (mit beispielen)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Sie k\u00f6nnen die folgende Syntax verwenden, um einer Matrix in NumPy eine Zeile hinzuzuf\u00fcgen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#add new_row to current_matrix<\/span>\ncurrent_matrix = np. <span style=\"color: #3366ff;\">vstack<\/span> ([current_matrix, new_row])\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Sie k\u00f6nnen auch die folgende Syntax verwenden, um nur Zeilen zu einer Matrix hinzuzuf\u00fcgen, die eine bestimmte Bedingung erf\u00fcllen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#only add rows where first element is less than 10<\/span>\ncurrent_matrix = np. <span style=\"color: #3366ff;\">vstack<\/span> ((current_matrix, new_rows[new_rows[:,0] &lt; <span style=\"color: #008000;\">10<\/span> ]))<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Die folgenden Beispiele zeigen, wie Sie diese Syntax in der Praxis anwenden k\u00f6nnen.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Beispiel 1: F\u00fcgen Sie der Matrix in NumPy eine Zeile hinzu<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Der folgende Code zeigt, wie man einer Matrix in NumPy eine neue Zeile hinzuf\u00fcgt:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n\n<span style=\"color: #008080;\">#define matrix\n<\/span>current_matrix = np. <span style=\"color: #3366ff;\">array<\/span> ([[1,2,3], [4, 5, 6], [7, 8, 9]])\n\n<span style=\"color: #008080;\">#define row to add\n<\/span>new_row = np. <span style=\"color: #3366ff;\">array<\/span> ([10, 11, 12])\n\n<span style=\"color: #008080;\">#add new row to matrix\n<\/span>current_matrix = np. <span style=\"color: #3366ff;\">vstack<\/span> ([current_matrix, new_row])\n\n<span style=\"color: #008080;\">#view updated matrix\n<\/span>current_matrix\n\narray([[ 1, 2, 3],\n       [4,5,6],\n       [7, 8, 9],\n       [10, 11, 12]])\n<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Beachten Sie, dass die letzte Zeile erfolgreich zur Matrix hinzugef\u00fcgt wurde.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Beispiel 2: Zeilen basierend auf der Bedingung zur Matrix hinzuf\u00fcgen<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">Der folgende Code zeigt, wie Sie basierend auf einer bestimmten Bedingung mehrere neue Zeilen zu einer vorhandenen Matrix hinzuf\u00fcgen:<\/span><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n\n<span style=\"color: #008080;\">#define matrix\n<\/span>current_matrix = np. <span style=\"color: #3366ff;\">array<\/span> ([[1, 2, 3], [4, 5, 6], [7, 8, 9]])\n\n<span style=\"color: #008080;\">#define potential new rows to add\n<\/span>new_rows = np. <span style=\"color: #3366ff;\">array<\/span> ([[6, 8, 10], [8, 10, 12], [10, 12, 14]])\n\n<span style=\"color: #008080;\">#only add rows where first element in row is less than 10\n<\/span>current_matrix = np. <span style=\"color: #3366ff;\">vstack<\/span> ((current_matrix, new_rows[new_rows[:,0] &lt; <span style=\"color: #008000;\">10<\/span> ]))\n\n<span style=\"color: #008080;\">#view updated matrix\n<\/span>current_matrix\n\narray([[ 1, 2, 3],\n       [4,5,6],\n       [7, 8, 9],\n       [6, 8, 10],\n       [8, 10, 12]])\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Es wurden nur Zeilen hinzugef\u00fcgt, deren erstes Element kleiner als 10 war.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Hinweis<\/strong> : Die vollst\u00e4ndige Online-Dokumentation f\u00fcr die <strong>vstack()<\/strong> -Funktion finden Sie <a href=\"https:\/\/numpy.org\/doc\/stable\/reference\/generated\/numpy.vstack.html\" target=\"_blank\" rel=\"noopener\">hier<\/a> .<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Zus\u00e4tzliche Ressourcen<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">In den folgenden Tutorials wird erl\u00e4utert, wie Sie andere g\u00e4ngige Vorg\u00e4nge in NumPy ausf\u00fchren:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/de\/numpy-suchwertindex\/\" target=\"_blank\" rel=\"noopener\">So finden Sie den Wertindex im NumPy-Array<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/numpy-array-zum-pandas-datenrahmen-hinzufugen\/\" target=\"_blank\" rel=\"noopener\">So f\u00fcgen Sie Pandas DataFrame ein Numpy-Array hinzu<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/numpy-array-zum-pandas-datenrahmen\/\" target=\"_blank\" rel=\"noopener\">So konvertieren Sie ein NumPy-Array in Pandas DataFrame<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sie k\u00f6nnen die folgende Syntax verwenden, um einer Matrix in NumPy eine Zeile hinzuzuf\u00fcgen: #add new_row to current_matrix current_matrix = np. vstack ([current_matrix, new_row]) Sie k\u00f6nnen auch die folgende Syntax verwenden, um nur Zeilen zu einer Matrix hinzuzuf\u00fcgen, die eine bestimmte Bedingung erf\u00fcllen: #only add rows where first element is less than 10 current_matrix = [&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>So f\u00fcgen Sie einer Matrix in NumPy eine Zeile hinzu (mit Beispielen) \u2013 Statistik<\/title>\n<meta name=\"description\" content=\"In diesem Tutorial wird anhand mehrerer Beispiele erkl\u00e4rt, wie man einer Matrix in NumPy eine Zeile hinzuf\u00fcgt.\" \/>\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\/numpy-fugt-der-matrix-eine-zeile-hinzu\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"So f\u00fcgen Sie einer Matrix in NumPy eine Zeile hinzu (mit Beispielen) \u2013 Statistik\" \/>\n<meta property=\"og:description\" content=\"In diesem Tutorial wird anhand mehrerer Beispiele erkl\u00e4rt, wie man einer Matrix in NumPy eine Zeile hinzuf\u00fcgt.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/de\/numpy-fugt-der-matrix-eine-zeile-hinzu\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-22T17:32:44+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\/numpy-fugt-der-matrix-eine-zeile-hinzu\/\",\"url\":\"https:\/\/statorials.org\/de\/numpy-fugt-der-matrix-eine-zeile-hinzu\/\",\"name\":\"So f\u00fcgen Sie einer Matrix in NumPy eine Zeile hinzu (mit Beispielen) \u2013 Statistik\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/de\/#website\"},\"datePublished\":\"2023-07-22T17:32:44+00:00\",\"dateModified\":\"2023-07-22T17:32:44+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\"},\"description\":\"In diesem Tutorial wird anhand mehrerer Beispiele erkl\u00e4rt, wie man einer Matrix in NumPy eine Zeile hinzuf\u00fcgt.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/de\/numpy-fugt-der-matrix-eine-zeile-hinzu\/#breadcrumb\"},\"inLanguage\":\"de-DE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/de\/numpy-fugt-der-matrix-eine-zeile-hinzu\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/de\/numpy-fugt-der-matrix-eine-zeile-hinzu\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Heim\",\"item\":\"https:\/\/statorials.org\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"So f\u00fcgen sie einer matrix in numpy eine zeile hinzu (mit beispielen)\"}]},{\"@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":"So f\u00fcgen Sie einer Matrix in NumPy eine Zeile hinzu (mit Beispielen) \u2013 Statistik","description":"In diesem Tutorial wird anhand mehrerer Beispiele erkl\u00e4rt, wie man einer Matrix in NumPy eine Zeile hinzuf\u00fcgt.","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\/numpy-fugt-der-matrix-eine-zeile-hinzu\/","og_locale":"de_DE","og_type":"article","og_title":"So f\u00fcgen Sie einer Matrix in NumPy eine Zeile hinzu (mit Beispielen) \u2013 Statistik","og_description":"In diesem Tutorial wird anhand mehrerer Beispiele erkl\u00e4rt, wie man einer Matrix in NumPy eine Zeile hinzuf\u00fcgt.","og_url":"https:\/\/statorials.org\/de\/numpy-fugt-der-matrix-eine-zeile-hinzu\/","og_site_name":"Statorials","article_published_time":"2023-07-22T17:32:44+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\/numpy-fugt-der-matrix-eine-zeile-hinzu\/","url":"https:\/\/statorials.org\/de\/numpy-fugt-der-matrix-eine-zeile-hinzu\/","name":"So f\u00fcgen Sie einer Matrix in NumPy eine Zeile hinzu (mit Beispielen) \u2013 Statistik","isPartOf":{"@id":"https:\/\/statorials.org\/de\/#website"},"datePublished":"2023-07-22T17:32:44+00:00","dateModified":"2023-07-22T17:32:44+00:00","author":{"@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0"},"description":"In diesem Tutorial wird anhand mehrerer Beispiele erkl\u00e4rt, wie man einer Matrix in NumPy eine Zeile hinzuf\u00fcgt.","breadcrumb":{"@id":"https:\/\/statorials.org\/de\/numpy-fugt-der-matrix-eine-zeile-hinzu\/#breadcrumb"},"inLanguage":"de-DE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/de\/numpy-fugt-der-matrix-eine-zeile-hinzu\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/de\/numpy-fugt-der-matrix-eine-zeile-hinzu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Heim","item":"https:\/\/statorials.org\/de\/"},{"@type":"ListItem","position":2,"name":"So f\u00fcgen sie einer matrix in numpy eine zeile hinzu (mit beispielen)"}]},{"@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\/2334"}],"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=2334"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/2334\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/media?parent=2334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/categories?post=2334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/tags?post=2334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}