{"id":271,"date":"2021-11-05T12:01:32","date_gmt":"2021-11-05T12:01:32","guid":{"rendered":"https:\/\/www.jibsheet.net\/linux\/?p=271"},"modified":"2021-11-05T12:01:32","modified_gmt":"2021-11-05T12:01:32","slug":"numpy-array-of-strings","status":"publish","type":"post","link":"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/","title":{"rendered":"Numpy &#8211; array of strings."},"content":{"rendered":"<p>Numpy supports strings and array of strings.\u00a0 \u00a0It is fixed length.<\/p>\n<p>If you replace an array element with a longer string it truncates it to fit.<\/p>\n<p>Each python character is 4 bytes ( unicode ). So a 40 character element in the array is 160 bytes.<\/p>\n<p>See example from Notebook below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-272\" src=\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook-300x204.png\" alt=\"\" width=\"715\" height=\"486\" srcset=\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook-300x204.png 300w, https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook-1024x698.png 1024w, https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook-768x523.png 768w, https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook.png 1142w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Numpy supports strings and array of strings.\u00a0 \u00a0It is fixed length. If you replace an array element with a longer string it truncates it to fit. Each python character is 4 bytes ( unicode ). So a 40 character element in the array is 160 bytes. See example from Notebook below.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Numpy - array of strings. - Jon Allen&#039;s Linux Stuff<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Numpy - array of strings. - Jon Allen&#039;s Linux Stuff\" \/>\n<meta property=\"og:description\" content=\"Numpy supports strings and array of strings.\u00a0 \u00a0It is fixed length. If you replace an array element with a longer string it truncates it to fit. Each python character is 4 bytes ( unicode ). So a 40 character element in the array is 160 bytes. See example from Notebook below.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/\" \/>\n<meta property=\"og:site_name\" content=\"Jon Allen&#039;s Linux Stuff\" \/>\n<meta property=\"article:published_time\" content=\"2021-11-05T12:01:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook-300x204.png\" \/>\n<meta name=\"author\" content=\"jonallen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"jonallen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/\"},\"author\":{\"name\":\"jonallen\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\"},\"headline\":\"Numpy &#8211; array of strings.\",\"datePublished\":\"2021-11-05T12:01:32+00:00\",\"dateModified\":\"2021-11-05T12:01:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/\"},\"wordCount\":51,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\"},\"image\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook-300x204.png\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/\",\"url\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/\",\"name\":\"Numpy - array of strings. - Jon Allen&#039;s Linux Stuff\",\"isPartOf\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook-300x204.png\",\"datePublished\":\"2021-11-05T12:01:32+00:00\",\"dateModified\":\"2021-11-05T12:01:32+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#primaryimage\",\"url\":\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook.png\",\"contentUrl\":\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook.png\",\"width\":1142,\"height\":778},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.jibsheet.net\/linux\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Numpy &#8211; array of strings.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#website\",\"url\":\"https:\/\/www.jibsheet.net\/linux\/\",\"name\":\"Jon Allen's Linux Stuff\",\"description\":\"Howto&#039;s, Observations, and stuff\",\"publisher\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.jibsheet.net\/linux\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\",\"name\":\"jonallen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g\",\"caption\":\"jonallen\"},\"logo\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/www.jibsheet.net\/linux\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Numpy - array of strings. - Jon Allen&#039;s Linux Stuff","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:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/","og_locale":"en_US","og_type":"article","og_title":"Numpy - array of strings. - Jon Allen&#039;s Linux Stuff","og_description":"Numpy supports strings and array of strings.\u00a0 \u00a0It is fixed length. If you replace an array element with a longer string it truncates it to fit. Each python character is 4 bytes ( unicode ). So a 40 character element in the array is 160 bytes. See example from Notebook below.","og_url":"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/","og_site_name":"Jon Allen&#039;s Linux Stuff","article_published_time":"2021-11-05T12:01:32+00:00","og_image":[{"url":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook-300x204.png"}],"author":"jonallen","twitter_card":"summary_large_image","twitter_misc":{"Written by":"jonallen","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#article","isPartOf":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/"},"author":{"name":"jonallen","@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993"},"headline":"Numpy &#8211; array of strings.","datePublished":"2021-11-05T12:01:32+00:00","dateModified":"2021-11-05T12:01:32+00:00","mainEntityOfPage":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/"},"wordCount":51,"commentCount":0,"publisher":{"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993"},"image":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#primaryimage"},"thumbnailUrl":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook-300x204.png","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/","url":"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/","name":"Numpy - array of strings. - Jon Allen&#039;s Linux Stuff","isPartOf":{"@id":"https:\/\/www.jibsheet.net\/linux\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#primaryimage"},"image":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#primaryimage"},"thumbnailUrl":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook-300x204.png","datePublished":"2021-11-05T12:01:32+00:00","dateModified":"2021-11-05T12:01:32+00:00","breadcrumb":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#primaryimage","url":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook.png","contentUrl":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2021\/11\/numpy_str_notebook.png","width":1142,"height":778},{"@type":"BreadcrumbList","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2021\/11\/05\/numpy-array-of-strings\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.jibsheet.net\/linux\/"},{"@type":"ListItem","position":2,"name":"Numpy &#8211; array of strings."}]},{"@type":"WebSite","@id":"https:\/\/www.jibsheet.net\/linux\/#website","url":"https:\/\/www.jibsheet.net\/linux\/","name":"Jon Allen's Linux Stuff","description":"Howto&#039;s, Observations, and stuff","publisher":{"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.jibsheet.net\/linux\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993","name":"jonallen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g","caption":"jonallen"},"logo":{"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.jibsheet.net\/linux"]}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts\/271"}],"collection":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/comments?post=271"}],"version-history":[{"count":2,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts\/271\/revisions"}],"predecessor-version":[{"id":274,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts\/271\/revisions\/274"}],"wp:attachment":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/media?parent=271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/categories?post=271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/tags?post=271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}