{"id":2263,"date":"2023-07-23T00:54:54","date_gmt":"2023-07-23T00:54:54","guid":{"rendered":"https:\/\/statorials.org\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/"},"modified":"2023-07-23T00:54:54","modified_gmt":"2023-07-23T00:54:54","slug":"numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz","status":"publish","type":"post","link":"https:\/\/statorials.org\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/","title":{"rendered":"Nas\u0131l d\u00fczeltilir: &#39;numpy.float64&#39; nesnesi int olarak yorumlanam\u0131yor"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">NumPy&#8217;yi kullan\u0131rken kar\u015f\u0131la\u015fabilece\u011finiz bir hata:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #ff0000;\">TypeError<\/span> : 'numpy.float64' object cannot be interpreted as an integer\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Bu hata, tamsay\u0131 bekleyen bir i\u015fleve kayan nokta sa\u011flad\u0131\u011f\u0131n\u0131zda ortaya \u00e7\u0131kar.<\/span><\/p>\n<p> <span style=\"color: #000000;\">A\u015fa\u011f\u0131daki \u00f6rnekte bu hatan\u0131n pratikte nas\u0131l d\u00fczeltilece\u011fi g\u00f6sterilmektedir.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Hata nas\u0131l yeniden olu\u015fturulur?<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Bir NumPy dizisine farkl\u0131 say\u0131lar\u0131 yazd\u0131rmak i\u00e7in a\u015fa\u011f\u0131daki for d\u00f6ng\u00fcs\u00fcn\u00fc kullanmaya \u00e7al\u0131\u015ft\u0131\u011f\u0131m\u0131z\u0131 varsayal\u0131m:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n\n<span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\">#define array of values<\/span>\ndata = np. <span style=\"color: #3366ff;\">array<\/span> ([3.3, 4.2, 5.1, 7.7, 10.8, 11.4])\n\n<span style=\"color: #008080;\">#use for loop to print out range of values at each index\n<\/span><span style=\"color: #008000;\">for<\/span> i <span style=\"color: #008000;\">in<\/span> range(len(data)):\n    <span style=\"color: #008000;\">print<\/span> (range(data[i]))\n\n<span style=\"color: #ff0000;\">TypeError<\/span> : 'numpy.float64' object cannot be interpreted as an integer\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><strong>range()<\/strong> fonksiyonu tamsay\u0131 bekledi\u011finden fakat NumPy dizisindeki de\u011ferler kayan nokta oldu\u011fundan hata al\u0131yoruz.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Hata nas\u0131l d\u00fczeltilir?<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Bu hatay\u0131 h\u0131zl\u0131 bir \u015fekilde d\u00fczeltmenin iki yolu vard\u0131r:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Y\u00f6ntem 1: int() i\u015flevini kullan\u0131n<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Bu hatay\u0131 d\u00fczeltmenin bir yolu, \u00e7a\u011fr\u0131y\u0131 <strong>int()<\/strong> ile a\u015fa\u011f\u0131daki gibi sarmakt\u0131r:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n\n<span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\">#define array of values<\/span>\ndata = np. <span style=\"color: #3366ff;\">array<\/span> ([3.3, 4.2, 5.1, 7.7, 10.8, 11.4])\n\n<span style=\"color: #008080;\">#use for loop to print out range of values at each index\n<\/span><span style=\"color: #008000;\">for<\/span> i <span style=\"color: #008000;\">in<\/span> range(len(data)):\n    <span style=\"color: #008000;\">print<\/span> (range(int(data[i])))\n\nrange(0, 3)\nrange(0, 4)\nrange(0, 5)\nrange(0, 7)\nrange(0, 10)\nrange(0, 11)\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Daha \u00f6nce kar\u015f\u0131la\u015ft\u0131\u011f\u0131m\u0131z <strong>TypeError hatas\u0131n\u0131<\/strong> \u00f6nlemek i\u00e7in <strong>int()<\/strong> fonksiyonunu kullanarak NumPy dizisindeki her float de\u011ferini bir tamsay\u0131ya d\u00f6n\u00fc\u015ft\u00fcr\u00fcyoruz.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Y\u00f6ntem 2: .astype(int) i\u015flevini kullanma<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Bu hatay\u0131 d\u00fczeltmenin ba\u015fka bir yolu da \u00f6ncelikle NumPy dizisi de\u011ferlerini tam say\u0131lara d\u00f6n\u00fc\u015ft\u00fcrmektir:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n\n<span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\">#define array of values\n<\/span>data = np. <span style=\"color: #3366ff;\">array<\/span> ([3.3, 4.2, 5.1, 7.7, 10.8, 11.4])\n\n<span style=\"color: #008080;\">#convert array of floats to array of integers<\/span>\ndata_int = data. <span style=\"color: #3366ff;\">astype<\/span> (int)\n\n<span style=\"color: #008080;\">#use for loop to print out range of values at each index\n<\/span><span style=\"color: #008000;\">for<\/span> i <span style=\"color: #008000;\">in<\/span> range(len(data)):\n    <span style=\"color: #008000;\">print<\/span> (range(data[i]))\n\nrange(0, 3)\nrange(0, 4)\nrange(0, 5)\nrange(0, 7)\nrange(0, 10)\nrange(0, 11)<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Bu y\u00f6ntemi kullanarak <strong>TypeError&#8217;dan<\/strong> tekrar ka\u00e7\u0131n\u0131r\u0131z.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Ek kaynaklar<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">A\u015fa\u011f\u0131daki e\u011fitimlerde Python&#8217;daki di\u011fer yayg\u0131n hatalar\u0131n nas\u0131l d\u00fczeltilece\u011fi a\u00e7\u0131klanmaktad\u0131r:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/tr\/pandalarin-anahtar-hatasi\/\" target=\"_blank\" rel=\"noopener\">Pandas&#8217;ta KeyError Nas\u0131l D\u00fczeltilir<\/a><br \/> <a href=\"https:\/\/statorials.org\/tr\/deger-hatasi-kayan-noktali-nani-tam-sayiya-donusturemiyor\/\" target=\"_blank\" rel=\"noopener\">Nas\u0131l d\u00fczeltilir? ValueError: float NaN int&#8217;ye d\u00f6n\u00fc\u015ft\u00fcr\u00fclemiyor<\/a><br \/> <a href=\"https:\/\/statorials.org\/tr\/islenenler-formlarla-yayinlanamadi\/\" target=\"_blank\" rel=\"noopener\">Nas\u0131l d\u00fczeltilir? ValueError: \u0130\u015flenenler \u015fekillerle yay\u0131nlanamad\u0131<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>NumPy&#8217;yi kullan\u0131rken kar\u015f\u0131la\u015fabilece\u011finiz bir hata: TypeError : &#8216;numpy.float64&#8217; object cannot be interpreted as an integer Bu hata, tamsay\u0131 bekleyen bir i\u015fleve kayan nokta sa\u011flad\u0131\u011f\u0131n\u0131zda ortaya \u00e7\u0131kar. A\u015fa\u011f\u0131daki \u00f6rnekte bu hatan\u0131n pratikte nas\u0131l d\u00fczeltilece\u011fi g\u00f6sterilmektedir. Hata nas\u0131l yeniden olu\u015fturulur? Bir NumPy dizisine farkl\u0131 say\u0131lar\u0131 yazd\u0131rmak i\u00e7in a\u015fa\u011f\u0131daki for d\u00f6ng\u00fcs\u00fcn\u00fc kullanmaya \u00e7al\u0131\u015ft\u0131\u011f\u0131m\u0131z\u0131 varsayal\u0131m: import numpy as np [&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-2263","post","type-post","status-publish","format-standard","hentry","category-rehber"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Nas\u0131l d\u00fczeltilir: &#039;numpy.float64&#039; nesnesi bir tamsay\u0131 olarak yorumlanam\u0131yor - Statorials<\/title>\n<meta name=\"description\" content=\"Bu e\u011fitimde Python&#039;da a\u015fa\u011f\u0131daki hatan\u0131n nas\u0131l d\u00fczeltilece\u011fi a\u00e7\u0131klanmaktad\u0131r: &#039;numpy.float64&#039; nesnesi bir tamsay\u0131 olarak yorumlanamaz.\" \/>\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\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Nas\u0131l d\u00fczeltilir: &#039;numpy.float64&#039; nesnesi bir tamsay\u0131 olarak yorumlanam\u0131yor - Statorials\" \/>\n<meta property=\"og:description\" content=\"Bu e\u011fitimde Python&#039;da a\u015fa\u011f\u0131daki hatan\u0131n nas\u0131l d\u00fczeltilece\u011fi a\u00e7\u0131klanmaktad\u0131r: &#039;numpy.float64&#039; nesnesi bir tamsay\u0131 olarak yorumlanamaz.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-23T00:54:54+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=\"Yazan:\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr.benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/\",\"url\":\"https:\/\/statorials.org\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/\",\"name\":\"Nas\u0131l d\u00fczeltilir: &#39;numpy.float64&#39; nesnesi bir tamsay\u0131 olarak yorumlanam\u0131yor - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/tr\/#website\"},\"datePublished\":\"2023-07-23T00:54:54+00:00\",\"dateModified\":\"2023-07-23T00:54:54+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/tr\/#\/schema\/person\/365dc158a39a7c8ae256355451e3de48\"},\"description\":\"Bu e\u011fitimde Python&#39;da a\u015fa\u011f\u0131daki hatan\u0131n nas\u0131l d\u00fczeltilece\u011fi a\u00e7\u0131klanmaktad\u0131r: &#39;numpy.float64&#39; nesnesi bir tamsay\u0131 olarak yorumlanamaz.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Ev\",\"item\":\"https:\/\/statorials.org\/tr\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Nas\u0131l d\u00fczeltilir: &#39;numpy.float64&#39; nesnesi int olarak yorumlanam\u0131yor\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/tr\/#website\",\"url\":\"https:\/\/statorials.org\/tr\/\",\"name\":\"Statorials\",\"description\":\"\u0130statistik okuryazarl\u0131\u011f\u0131 rehberiniz!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/tr\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"tr\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/tr\/#\/schema\/person\/365dc158a39a7c8ae256355451e3de48\",\"name\":\"Dr.benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"tr\",\"@id\":\"https:\/\/statorials.org\/tr\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/tr\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/tr\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr.benjamin anderson\"},\"description\":\"Merhaba, ben Benjamin, emekli bir istatistik profes\u00f6r\u00fc ve Statorials \u00f6\u011fretmenine d\u00f6n\u00fc\u015ft\u00fcm. \u0130statistik alan\u0131ndaki kapsaml\u0131 deneyimim ve uzmanl\u0131\u011f\u0131mla, \u00f6\u011frencilerimi Statorials arac\u0131l\u0131\u011f\u0131yla g\u00fc\u00e7lendirmek i\u00e7in bilgilerimi payla\u015fmaya can at\u0131yorum. Daha fazlas\u0131n\u0131 bil\",\"sameAs\":[\"https:\/\/statorials.org\/tr\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Nas\u0131l d\u00fczeltilir: &#39;numpy.float64&#39; nesnesi bir tamsay\u0131 olarak yorumlanam\u0131yor - Statorials","description":"Bu e\u011fitimde Python&#39;da a\u015fa\u011f\u0131daki hatan\u0131n nas\u0131l d\u00fczeltilece\u011fi a\u00e7\u0131klanmaktad\u0131r: &#39;numpy.float64&#39; nesnesi bir tamsay\u0131 olarak yorumlanamaz.","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\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/","og_locale":"tr_TR","og_type":"article","og_title":"Nas\u0131l d\u00fczeltilir: &#39;numpy.float64&#39; nesnesi bir tamsay\u0131 olarak yorumlanam\u0131yor - Statorials","og_description":"Bu e\u011fitimde Python&#39;da a\u015fa\u011f\u0131daki hatan\u0131n nas\u0131l d\u00fczeltilece\u011fi a\u00e7\u0131klanmaktad\u0131r: &#39;numpy.float64&#39; nesnesi bir tamsay\u0131 olarak yorumlanamaz.","og_url":"https:\/\/statorials.org\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/","og_site_name":"Statorials","article_published_time":"2023-07-23T00:54:54+00:00","author":"Dr.benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Yazan:":"Dr.benjamin anderson","Tahmini okuma s\u00fcresi":"2 dakika"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/","url":"https:\/\/statorials.org\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/","name":"Nas\u0131l d\u00fczeltilir: &#39;numpy.float64&#39; nesnesi bir tamsay\u0131 olarak yorumlanam\u0131yor - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/tr\/#website"},"datePublished":"2023-07-23T00:54:54+00:00","dateModified":"2023-07-23T00:54:54+00:00","author":{"@id":"https:\/\/statorials.org\/tr\/#\/schema\/person\/365dc158a39a7c8ae256355451e3de48"},"description":"Bu e\u011fitimde Python&#39;da a\u015fa\u011f\u0131daki hatan\u0131n nas\u0131l d\u00fczeltilece\u011fi a\u00e7\u0131klanmaktad\u0131r: &#39;numpy.float64&#39; nesnesi bir tamsay\u0131 olarak yorumlanamaz.","breadcrumb":{"@id":"https:\/\/statorials.org\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/tr\/numpy-float64-nesnesi-bir-tamsayi-olarak-yorumlanamaz\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Ev","item":"https:\/\/statorials.org\/tr\/"},{"@type":"ListItem","position":2,"name":"Nas\u0131l d\u00fczeltilir: &#39;numpy.float64&#39; nesnesi int olarak yorumlanam\u0131yor"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/tr\/#website","url":"https:\/\/statorials.org\/tr\/","name":"Statorials","description":"\u0130statistik okuryazarl\u0131\u011f\u0131 rehberiniz!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/tr\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"tr"},{"@type":"Person","@id":"https:\/\/statorials.org\/tr\/#\/schema\/person\/365dc158a39a7c8ae256355451e3de48","name":"Dr.benjamin anderson","image":{"@type":"ImageObject","inLanguage":"tr","@id":"https:\/\/statorials.org\/tr\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/tr\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/tr\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr.benjamin anderson"},"description":"Merhaba, ben Benjamin, emekli bir istatistik profes\u00f6r\u00fc ve Statorials \u00f6\u011fretmenine d\u00f6n\u00fc\u015ft\u00fcm. \u0130statistik alan\u0131ndaki kapsaml\u0131 deneyimim ve uzmanl\u0131\u011f\u0131mla, \u00f6\u011frencilerimi Statorials arac\u0131l\u0131\u011f\u0131yla g\u00fc\u00e7lendirmek i\u00e7in bilgilerimi payla\u015fmaya can at\u0131yorum. Daha fazlas\u0131n\u0131 bil","sameAs":["https:\/\/statorials.org\/tr"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/posts\/2263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/comments?post=2263"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/posts\/2263\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/media?parent=2263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/categories?post=2263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/tr\/wp-json\/wp\/v2\/tags?post=2263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}