{"id":2499,"date":"2023-07-22T00:32:30","date_gmt":"2023-07-22T00:32:30","guid":{"rendered":"https:\/\/statorials.org\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/"},"modified":"2023-07-22T00:32:30","modified_gmt":"2023-07-22T00:32:30","slug":"loggetto-numpy-ndarray-non-e-richiamabile","status":"publish","type":"post","link":"https:\/\/statorials.org\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/","title":{"rendered":"Come risolvere in python: l&#39;oggetto &#39;numpy.ndarray&#39; non \u00e8 richiamabile"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Un errore comune che potresti riscontrare quando usi NumPy in Python \u00e8:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #ff0000;\">TypeError<\/span> : 'numpy.ndarray' object is not callable\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Questo errore si verifica in genere quando si tenta di chiamare un array NumPy come funzione utilizzando parentesi tonde <strong>()<\/strong> anzich\u00e9 parentesi quadre <strong>[ ]<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">L&#8217;esempio seguente mostra come utilizzare questa sintassi nella pratica.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Come riprodurre l&#8217;errore<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Supponiamo di avere il seguente array NumPy:<\/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;\">#create NumPy array\n<span style=\"color: #000000;\">x = np. <span style=\"color: #3366ff;\">array<\/span> ([2, 4, 4, 5, 9, 12, 14, 17, 18, 20, 22, 25])\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Supponiamo ora di provare ad accedere al primo elemento dell&#8217;array:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#attempt to access the first element in the array\n<span style=\"color: #000000;\">x(0)\n\n<span style=\"color: #ff0000;\">TypeError<\/span> : 'numpy.ndarray' object is not callable\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Dato che abbiamo utilizzato le parentesi tonde <strong>()<\/strong> , Python pensa che stiamo cercando di chiamare l&#8217;array NumPy <strong>x<\/strong> come una funzione.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Poich\u00e9 x non \u00e8 una funzione, riceviamo un errore.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Come correggere l&#8217;errore<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Il modo per risolvere questo errore \u00e8 utilizzare semplicemente le parentesi quadre <strong>[ ]<\/strong> quando si accede agli elementi dell&#8217;array NumPy invece delle parentesi tonde <strong>()<\/strong> :<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#access the first element in the array\n<span style=\"color: #000000;\">x[0]\n\n2<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Viene visualizzato il primo elemento dell&#8217;array (2) e non riceviamo alcun errore perch\u00e9 abbiamo utilizzato le parentesi quadre <strong>[ ]<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Tieni inoltre presente che possiamo accedere a pi\u00f9 elementi dell&#8217;array contemporaneamente purch\u00e9 utilizziamo parentesi quadre <strong>[ ]<\/strong> :<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#find sum of first three elements in array\n<span style=\"color: #000000;\">x[0] + x[1] + x[2]\n\n10<\/span><\/span><\/strong><\/pre>\n<h3> <span style=\"color: #000000;\"><strong>Risorse addizionali<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">I seguenti tutorial spiegano come correggere altri errori comuni in Python:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/it\/lindice-valueerror-contiene-voci-duplicate-che-non-possono-essere-rimodellate\/\" target=\"_blank\" rel=\"noopener\">Come risolvere il problema: ValueError: l&#8217;indice contiene voci duplicate, non pu\u00f2 essere rimodellato<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/stringa-di-errore-di-tipo-previsto-o-byte-come-oggetto\/\" target=\"_blank\" rel=\"noopener\">Come risolvere il problema: Errore di tipo: oggetto stringa o byte previsto<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/loggetto-numpy-float64-non-e-un-errore-richiamabile\/\" target=\"_blank\" rel=\"noopener\">Come risolvere il problema: TypeError: l&#8217;oggetto &#8220;numpy.float64&#8221; non \u00e8 richiamabile<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Un errore comune che potresti riscontrare quando usi NumPy in Python \u00e8: TypeError : &#8216;numpy.ndarray&#8217; object is not callable Questo errore si verifica in genere quando si tenta di chiamare un array NumPy come funzione utilizzando parentesi tonde () anzich\u00e9 parentesi quadre [ ] . L&#8217;esempio seguente mostra come utilizzare questa sintassi nella pratica. Come [&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>Come risolvere in Python: l&#039;oggetto &#039;numpy.ndarray&#039; non \u00e8 richiamabile - Statorials<\/title>\n<meta name=\"description\" content=\"Questo tutorial spiega come correggere il seguente errore in Python: l&#039;oggetto &#039;numpy.ndarray&#039; non \u00e8 richiamabile.\" \/>\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\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Come risolvere in Python: l&#039;oggetto &#039;numpy.ndarray&#039; non \u00e8 richiamabile - Statorials\" \/>\n<meta property=\"og:description\" content=\"Questo tutorial spiega come correggere il seguente errore in Python: l&#039;oggetto &#039;numpy.ndarray&#039; non \u00e8 richiamabile.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-22T00:32:30+00:00\" \/>\n<meta name=\"author\" content=\"Benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minuto\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/\",\"url\":\"https:\/\/statorials.org\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/\",\"name\":\"Come risolvere in Python: l&#39;oggetto &#39;numpy.ndarray&#39; non \u00e8 richiamabile - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/it\/#website\"},\"datePublished\":\"2023-07-22T00:32:30+00:00\",\"dateModified\":\"2023-07-22T00:32:30+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\"},\"description\":\"Questo tutorial spiega come correggere il seguente errore in Python: l&#39;oggetto &#39;numpy.ndarray&#39; non \u00e8 richiamabile.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Casa\",\"item\":\"https:\/\/statorials.org\/it\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Come risolvere in python: l&#39;oggetto &#39;numpy.ndarray&#39; non \u00e8 richiamabile\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/it\/#website\",\"url\":\"https:\/\/statorials.org\/it\/\",\"name\":\"Statorials\",\"description\":\"La tua guida all&#039;alfabetizzazione statistica!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/it\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"it-IT\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\",\"name\":\"Benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Benjamin anderson\"},\"description\":\"Ciao, sono Benjamin, un professore di statistica in pensione diventato insegnante dedicato di Statorials. Con una vasta esperienza e competenza nel campo della statistica, sono ansioso di condividere le mie conoscenze per potenziare gli studenti attraverso Statorials. Scopri di pi\u00f9\",\"sameAs\":[\"https:\/\/statorials.org\/it\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Come risolvere in Python: l&#39;oggetto &#39;numpy.ndarray&#39; non \u00e8 richiamabile - Statorials","description":"Questo tutorial spiega come correggere il seguente errore in Python: l&#39;oggetto &#39;numpy.ndarray&#39; non \u00e8 richiamabile.","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\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/","og_locale":"it_IT","og_type":"article","og_title":"Come risolvere in Python: l&#39;oggetto &#39;numpy.ndarray&#39; non \u00e8 richiamabile - Statorials","og_description":"Questo tutorial spiega come correggere il seguente errore in Python: l&#39;oggetto &#39;numpy.ndarray&#39; non \u00e8 richiamabile.","og_url":"https:\/\/statorials.org\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/","og_site_name":"Statorials","article_published_time":"2023-07-22T00:32:30+00:00","author":"Benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Benjamin anderson","Est. reading time":"1 minuto"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/","url":"https:\/\/statorials.org\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/","name":"Come risolvere in Python: l&#39;oggetto &#39;numpy.ndarray&#39; non \u00e8 richiamabile - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/it\/#website"},"datePublished":"2023-07-22T00:32:30+00:00","dateModified":"2023-07-22T00:32:30+00:00","author":{"@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae"},"description":"Questo tutorial spiega come correggere il seguente errore in Python: l&#39;oggetto &#39;numpy.ndarray&#39; non \u00e8 richiamabile.","breadcrumb":{"@id":"https:\/\/statorials.org\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/it\/loggetto-numpy-ndarray-non-e-richiamabile\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Casa","item":"https:\/\/statorials.org\/it\/"},{"@type":"ListItem","position":2,"name":"Come risolvere in python: l&#39;oggetto &#39;numpy.ndarray&#39; non \u00e8 richiamabile"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/it\/#website","url":"https:\/\/statorials.org\/it\/","name":"Statorials","description":"La tua guida all&#039;alfabetizzazione statistica!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/it\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"it-IT"},{"@type":"Person","@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae","name":"Benjamin anderson","image":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Benjamin anderson"},"description":"Ciao, sono Benjamin, un professore di statistica in pensione diventato insegnante dedicato di Statorials. Con una vasta esperienza e competenza nel campo della statistica, sono ansioso di condividere le mie conoscenze per potenziare gli studenti attraverso Statorials. Scopri di pi\u00f9","sameAs":["https:\/\/statorials.org\/it"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/2499"}],"collection":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/comments?post=2499"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/2499\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/media?parent=2499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/categories?post=2499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/tags?post=2499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}