On Sunday 10 December 2006 12:36, vertigo wrote:
Hello
How to create table with string variables ?
I tried
import string
X = zeros([10,10], string)
(i used Numeric.Float earlier, but now can't find string class anywhere)
Thanx
I've read that the Numeric module is being replaced/better supported by NumPy.
Anyway, try:
X = zeros ([10,10], str)
I have numpy installed so I did:
>>from numpy import *
X = zeros ([10,10], str)
X
array([['', '', '', '', '', '', '', '', '', ''],
['', '', '', '', '', '', '', '', '', ''],
['', '', '', '', '', '', '', '', '', ''],
['', '', '', '', '', '', '', '', '', ''],
['', '', '', '', '', '', '', '', '', ''],
['', '', '', '', '', '', '', '', '', ''],
['', '', '', '', '', '', '', '', '', ''],
['', '', '', '', '', '', '', '', '', ''],
['', '', '', '', '', '', '', '', '', ''],
['', '', '', '', '', '', '', '', '', '']],
dtype='|S1')
>>>
seemed to work, hope this helps.
- Jonathan