{"id":4323,"date":"2023-07-12T00:47:27","date_gmt":"2023-07-12T00:47:27","guid":{"rendered":"https:\/\/statorials.org\/nl\/pandas-beschrijven-categorisch\/"},"modified":"2023-07-12T00:47:27","modified_gmt":"2023-07-12T00:47:27","slug":"pandas-beschrijven-categorisch","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/pandas-beschrijven-categorisch\/","title":{"rendered":"Panda&#39;s: hoe write() te gebruiken voor categorische variabelen"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Standaard berekent de functie <strong>beschrijven()<\/strong> in panda&#8217;s beschrijvende statistieken voor alle numerieke variabelen in een DataFrame.<\/span><\/p>\n<p> <span style=\"color: #000000;\">U kunt echter ook de volgende methoden gebruiken om beschrijvende statistieken voor<a href=\"https:\/\/statorials.org\/nl\/categorisch-versus-kwantitatief\/\" target=\"_blank\" rel=\"noopener\">categorische variabelen<\/a> te berekenen:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Methode 1: Bereken beschrijvende statistieken voor categorische variabelen<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong>df. <span style=\"color: #3366ff;\">describe<\/span> (include=' <span style=\"color: #ff0000;\">object<\/span> ')\n<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Deze methode berekent <strong>count<\/strong> , <strong>unique<\/strong> , <strong>top<\/strong> en <strong>freq<\/strong> voor elke categorische variabele in een DataFrame.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Methode 2: Bereken categorische beschrijvende statistieken voor alle variabelen<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>df. <span style=\"color: #3366ff;\">astype<\/span> (' <span style=\"color: #ff0000;\">object<\/span> '). <span style=\"color: #3366ff;\">describe<\/span> ()<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Deze methode berekent <strong>count<\/strong> , <strong>unique<\/strong> , <strong>top<\/strong> en <strong>freq<\/strong> voor elke variabele in een DataFrame.<\/span><\/p>\n<p> <span style=\"color: #000000;\">De volgende voorbeelden laten zien hoe u elke methode kunt gebruiken met de volgende panda&#8217;s DataFrame die<\/span> <span style=\"color: #000000;\">informatie bevat over verschillende basketbalspelers:<\/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;\">#createDataFrame\n<\/span>df = pd. <span style=\"color: #3366ff;\">DataFrame<\/span> ({' <span style=\"color: #ff0000;\">team<\/span> ': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'],\n                   ' <span style=\"color: #ff0000;\">points<\/span> ': [18, 22, 19, 14, 14, 11, 20, 28],\n                   ' <span style=\"color: #ff0000;\">assists<\/span> ': [5, 7, 7, 9, 12, 9, 9, 4],\n                   ' <span style=\"color: #ff0000;\">rebounds<\/span> ': [11, 8, 10, 6, 6, 5, 9, 12]})\n\n<span style=\"color: #008080;\">#view DataFrame\n<\/span><span style=\"color: #008000;\">print<\/span> (df)\n\n  team points assists rebounds\n0 A 18 5 11\n1 B 22 7 8\n2 C 19 7 10\n3 D 14 9 6\n4 E 14 12 6\n5 F 11 9 5\n6 G 20 9 9\n7:28 4 12\n<\/strong><\/span><\/pre>\n<h2> <span style=\"color: #000000;\"><strong>Voorbeeld 1: Bereken beschrijvende statistieken voor categorische variabelen<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">We kunnen de volgende syntaxis gebruiken om beschrijvende statistieken te berekenen voor elke categorische variabele in het DataFrame:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#calculate descriptive statistics for categorical variables only\n<span style=\"color: #000000;\">df. <span style=\"color: #3366ff;\">describe<\/span> (include=' <span style=\"color: #ff0000;\">object<\/span> ')\n<\/span><\/span>\nteam\ncount 8\nsingle 8\ntop A\nfreq 1<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">De uitvoer geeft verschillende beschrijvende statistieken weer voor de enkele categorische variabele ( <strong>team<\/strong> ) in het DataFrame.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Zo interpreteert u het resultaat:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>count<\/strong> : Er zijn 8 waarden in de teamkolom.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>uniek<\/strong> : Er zijn 8 unieke waarden in de teamkolom.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>top<\/strong> : De \u201ctop\u201d-waarde (dwz de hoogste in het alfabet) is A.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>freq<\/strong> : Deze maximale waarde verschijnt 1 keer.<\/span><\/li>\n<\/ul>\n<h2> <span style=\"color: #000000;\"><strong>Voorbeeld 2: Bereken categorische beschrijvende statistieken voor alle variabelen<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">We kunnen de volgende syntaxis gebruiken om <strong>count<\/strong> , <strong>unique<\/strong> , <strong>top<\/strong> en <strong>freq<\/strong> voor elke variabele in het DataFrame te berekenen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#calculate categorical descriptive statistics for all variables\n<\/span>df. <span style=\"color: #3366ff;\">astype<\/span> (' <span style=\"color: #ff0000;\">object<\/span> '). <span style=\"color: #3366ff;\">describe<\/span> ()\n\n        team points assists rebounds\ncount 8 8 8 8\nsingle 8 7 5 7\ntop A 14 9 6\nfreq 1 2 3 2<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">De uitvoer geeft <strong>count<\/strong> , <strong>unique<\/strong> , <strong>top<\/strong> en <strong>freq<\/strong> weer voor elke variabele in het DataFrame, inclusief numerieke variabelen.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Aanvullende bronnen<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">In de volgende tutorials wordt uitgelegd hoe u andere veelvoorkomende bewerkingen in panda&#8217;s kunt uitvoeren:<\/span><\/p>\n<p><a href=\"https:\/\/statorials.org\/nl\/pandas-groepsgewijs-beschrijven\/\" target=\"_blank\" rel=\"noopener\">Panda&#8217;s: beschrijven() gebruiken per groep<\/a><br \/><a href=\"https:\/\/statorials.org\/nl\/pandas-beschrijven-percentielen\/\" target=\"_blank\" rel=\"noopener\">Panda&#8217;s: beschrijven() gebruiken met specifieke percentielen<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/pandas-beschrijven-geen-wetenschappelijke-notatie\/\" target=\"_blank\" rel=\"noopener\">Panda&#8217;s: beschrijven() gebruiken en wetenschappelijke notatie verwijderen<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Standaard berekent de functie beschrijven() in panda&#8217;s beschrijvende statistieken voor alle numerieke variabelen in een DataFrame. U kunt echter ook de volgende methoden gebruiken om beschrijvende statistieken voorcategorische variabelen te berekenen: Methode 1: Bereken beschrijvende statistieken voor categorische variabelen df. describe (include=&#8216; object &#8218;) Deze methode berekent count , unique , top en freq voor [&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":[],"class_list":["post-4323","post","type-post","status-publish","format-standard","hentry","category-gids"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Panda&#039;s: Hoe te beschrijven() gebruiken voor categorische variabelen \u2013 Statorials<\/title>\n<meta name=\"description\" content=\"In deze tutorial wordt uitgelegd hoe u de functie beschrijven() gebruikt met categorische variabelen in een pandas DataFrame, inclusief voorbeelden.\" \/>\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\/nl\/pandas-beschrijven-categorisch\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Panda&#039;s: Hoe te beschrijven() gebruiken voor categorische variabelen \u2013 Statorials\" \/>\n<meta property=\"og:description\" content=\"In deze tutorial wordt uitgelegd hoe u de functie beschrijven() gebruikt met categorische variabelen in een pandas DataFrame, inclusief voorbeelden.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/pandas-beschrijven-categorisch\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-12T00:47:27+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\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/nl\/pandas-beschrijven-categorisch\/\",\"url\":\"https:\/\/statorials.org\/nl\/pandas-beschrijven-categorisch\/\",\"name\":\"Panda&#39;s: Hoe te beschrijven() gebruiken voor categorische variabelen \u2013 Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-12T00:47:27+00:00\",\"dateModified\":\"2023-07-12T00:47:27+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze tutorial wordt uitgelegd hoe u de functie beschrijven() gebruikt met categorische variabelen in een pandas DataFrame, inclusief voorbeelden.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/pandas-beschrijven-categorisch\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/pandas-beschrijven-categorisch\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/pandas-beschrijven-categorisch\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Panda&#39;s: hoe write() te gebruiken voor categorische variabelen\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/nl\/#website\",\"url\":\"https:\/\/statorials.org\/nl\/\",\"name\":\"Statorials\",\"description\":\"Uw gids voor statistische competentie\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/nl\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\",\"name\":\"Dr.benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr.benjamin anderson\"},\"description\":\"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder\",\"sameAs\":[\"http:\/\/statorials.org\/nl\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Panda&#39;s: Hoe te beschrijven() gebruiken voor categorische variabelen \u2013 Statorials","description":"In deze tutorial wordt uitgelegd hoe u de functie beschrijven() gebruikt met categorische variabelen in een pandas DataFrame, inclusief voorbeelden.","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\/nl\/pandas-beschrijven-categorisch\/","og_locale":"de_DE","og_type":"article","og_title":"Panda&#39;s: Hoe te beschrijven() gebruiken voor categorische variabelen \u2013 Statorials","og_description":"In deze tutorial wordt uitgelegd hoe u de functie beschrijven() gebruikt met categorische variabelen in een pandas DataFrame, inclusief voorbeelden.","og_url":"https:\/\/statorials.org\/nl\/pandas-beschrijven-categorisch\/","og_site_name":"Statorials","article_published_time":"2023-07-12T00:47:27+00:00","author":"Dr.benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr.benjamin anderson","Gesch\u00e4tzte Lesezeit":"2\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/nl\/pandas-beschrijven-categorisch\/","url":"https:\/\/statorials.org\/nl\/pandas-beschrijven-categorisch\/","name":"Panda&#39;s: Hoe te beschrijven() gebruiken voor categorische variabelen \u2013 Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-12T00:47:27+00:00","dateModified":"2023-07-12T00:47:27+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze tutorial wordt uitgelegd hoe u de functie beschrijven() gebruikt met categorische variabelen in een pandas DataFrame, inclusief voorbeelden.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/pandas-beschrijven-categorisch\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/pandas-beschrijven-categorisch\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/pandas-beschrijven-categorisch\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Panda&#39;s: hoe write() te gebruiken voor categorische variabelen"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/nl\/#website","url":"https:\/\/statorials.org\/nl\/","name":"Statorials","description":"Uw gids voor statistische competentie","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/nl\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de"},{"@type":"Person","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219","name":"Dr.benjamin anderson","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/","url":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr.benjamin anderson"},"description":"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder","sameAs":["http:\/\/statorials.org\/nl"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/4323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/comments?post=4323"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/4323\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=4323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=4323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=4323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}