Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6678949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:18:09+00:00 2026-05-26T04:18:09+00:00

The following code is from the Numpy 1.4.1 manual, numpy.char import numpy as np

  • 0

The following code is from the Numpy 1.4.1 manual, numpy.char

import numpy as np
charar = np.chararray((3, 3))
charar[:, :] = 'abc'
print charar

According to the manual, this is supposed to output

chararray([['a', 'a', 'a'],
       ['a', 'a', 'a'],
       ['a', 'a', 'a']],
      dtype='|S1')

Instead I get

[['\xd8' '3' 'U']
 ['\xb7' '\x18' '\xc2']
 ['\xbd' '' '\x10']]

This looks like uninitialized values. Does anyone have any ideas what is going on here? I’m using the numpy package for Debian squeeze, which I realise is out of date, but I’m having some problems backporting the 1.6 package from unstable.

UPDATE: I’ve now backported the 1.6 package from unstable, minus the docs, which won’t build for some reason. I get exactly the same results. I guess I’ll go ahead and report this to the numpy project.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:18:09+00:00Added an answer on May 26, 2026 at 4:18 am

    I don’t have numpy 1.4 installed on my machine, but certainly if I run the code you wrote, I get a similar answer that doesn’t match the manual. It should be noted though that in the newest version of the numpy manual the example has changed:

    >>> charar = np.chararray((3, 3))
    >>> charar[:] = 'a'
    >>> charar
    chararray([['a', 'a', 'a'],
           ['a', 'a', 'a'],
           ['a', 'a', 'a']],
          dtype='|S1')
    

    See http://docs.scipy.org/doc/numpy/reference/generated/numpy.chararray.html

    Also, np.chararray post v1.4 is only included in numpy for backward compatibility with Numarray, and the manual states that it shouldn’t be used for new development.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following code: from numpy import log2 import matplotlib.pyplot as plt xdata =
I have the following code: from selenium import selenium selenium = selenium(localhost, 4444, *chrome,
I am plotting a confusion matrix with matplotlib with the following code: from numpy
I got the following code from this question: What is the best way to
I am executing following code from this post : preg_match_all(/'(.+)' ((\w+)\(? ?(\d*) ?\)?)/, $sql,
I have the following code: from lxml.builder import ElementMaker E = ElementMaker() params =
Consider the following code: from PIL import Image, ImageDraw, ImageFont def addText(img, lTxt): FONT_SIZE
I have the following code from apache's svn. As you can see this is
the following code (from a database object created for each new view): -(void)update:(NSString *)queryText{
I have got the following code from here to read an Excel file using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.