Try changing
adSuggester['queryToks']=qA
to
adSuggester['queryToks'][:]=qA
Be Well
Anthony
On Sat, Mar 17, 2012 at 9:13 AM, sreeaurovindh viswanathan <
sreeaurovi...@gmail.com> wrote:
>
>
> On Sat, Mar 17, 2012 at 7:34 PM, sreeaurovindh viswanathan <
> sreeaurovi...@gmail.com> wrote:
>
>> Hi,
>>
>> I have a numpy array which i am trying to save to an array in the table.I
>> am not sure why i am getting the following error.
>>
>> Table name is adSuggester
>> queryToks=Int32Col(shape=129,pos=8)
>>
>> and the numpy array is the following.I have initialized all the values
>> to zero.
>>
>> qA=np.zeros((129),dtype=np.int32) # !! Edit in second post
>> count=0
>> for q in range(1,129): #!! Edit in second post
>>
>> count=count+1
>> qA[count]=-1
>>
>>
>> and I am fetching value from the database into the numpy array and adding
>> it to the table
>>
>> selectQueryTr="select query_token from kdd.query_tokens where
>> query_id="
>> selectQueryTr+=str(trainVals[8])
>> cur.execute(selectQueryTr)
>> allQueryTokens=cur.fetchall()
>> count=0
>> for queryT in allQueryTokens:
>> count=count+1
>> qA[count]=int(queryT[0])
>> adSuggester['queryToks']=qA
>>
>> when i close the hdf5 file or do a table.flush the following error gets
>> thrown.Can you please help me with this.
>>
>> Thanks.
>> Sree aurovindh V
>>
>> ValueError: value parameter '[[ -1 -1 -1 -1 -1 -1 -1 -1
>> -1 -1 -1 -1 -1 -1
>> -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
>> -1 -1 -1 -1 -1 0 1 1 1 29 72 89 111 164
>> 174 223 298 329 725 923 1047 1181 2887 7632]
>> [ -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
>> -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
>> -1 -1 -1 -1 -1 0 1 1 1 29 72 89 111 164
>> 174 223 298 329 725 923 1047 1181 2887 7632]]' cannot be converted
>> into an array object
>> compliant with LastRowArray: '/kddData/_i_dataset/descToks/sortedLR
>> (LastRowArray(131201,), shuffle, zlib(1)) 'Last Row sorted values + bounds'
>> atom := Int32Atom(shape=(), dflt=0)
>> maindim := 0 ... (truncated)
>> File "c:\Research Docket\KDD\2012 dataset\Scripts\Script
>> Modified\hd5-Kdd-ch1_mod.py", line 147, in <module>
>> h5file.close()
>> File "C:\Python27\Lib\site-packages\tables\file.py", line 2141, in close
>> self.root._f_close()
>> File "C:\Python27\Lib\site-packages\tables\group.py", line 968, in
>> _f_close
>> self._g_closeDescendents()
>> File "C:\Python27\Lib\site-packages\tables\group.py", line 918, in
>> _g_closeDescendents
>> lambda path: aliveNodes[path])
>> File "C:\Python27\Lib\site-packages\tables\group.py", line 899, in
>> closeNodes
>> node._f_close()
>> File "C:\Python27\Lib\site-packages\tables\table.py", line 2764, in
>> _f_close
>> self.flush()
>> File "C:\Python27\Lib\site-packages\tables\table.py", line 2703, in flush
>> rowsadded = self.flushRowsToIndex(_lastrow=True)
>> File "C:\Python27\Lib\site-packages\tables\table.py", line 2375, in
>> flushRowsToIndex
>> colname, start, nrows, _lastrow, update=True )
>> File "C:\Python27\Lib\site-packages\tables\table.py", line 2406, in
>> _addRowsToIndex
>> update=update)
>> File "C:\Python27\Lib\site-packages\tables\index.py", line 744, in
>> appendLastRow
>> sortedLR[nelementsSLR:nelementsSLR+offset2] = self.bebounds
>> File "C:\Python27\Lib\site-packages\tables\array.py", line 743, in
>> __setitem__
>> self._writeSlice(startl, stopl, stepl, shape, nparr)
>> File "C:\Python27\Lib\site-packages\tables\array.py", line 821, in
>> _writeSlice
>> nparr = self._checkShape(nparr, tuple(shape))
>> File "C:\Python27\Lib\site-packages\tables\array.py", line 770, in
>> _checkShape
>> (nparr, self.__class__.__name__, self, exc)
>>
>
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Pytables-users mailing list
> Pytables-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pytables-users
>
>
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users