Hello Sreeaurovindh,
The problem is not with PyTables, but rather that you have a bug in the
code.
You assign table to be the adSuggester table and then try to access
queryToken
attributes / columns. This line:
queryToken=table.row
should really be:
queryToken=queryTable.row
Be Well
Anthony
On Wed, Mar 14, 2012 at 11:16 AM, sreeaurovindh viswanathan <
sreeaurovi...@gmail.com> wrote:
> Hi,
>
> I have the following tables in my python code.When i try to access the
> adSuggester['trId'] it works but whereas when i try to use
> queryToken['qId'] it throws me an keyerror.However this is strange because
> this key exists in the definition of the table.Please help me to resolve
> this issue.
> Thanks
>
> Traceback (most recent call last):
> File "C:\Research Docket\KDD\2012 dataset\hd5Writes\hd5-ch1.py", line
> 88, in <
> module>
> queryToken['qId']=trainVals[8]
> File "tableExtension.pyx", line 1426, in
> tables.tableExtension.Row.__setitem__
> (tables\tableExtension.c:11735)
> File "tableExtension.pyx", line 133, in
> tables.tableExtension.getNestedFieldCa
> che (tables\tableExtension.c:1675)
> File "utilsExtension.pyx", line 497, in
> tables.utilsExtension.getNestedField (
> tables\utilsExtension.c:3695)
> KeyError: 'no such column: qId'
> Closing remaining open files: train_1.h5... done
>
> Below is the python code:
>
> class adSuggester(IsDescription):
> trId = UInt32Col(pos=0)
> click=UInt16Col(pos=1)
>
> class queryToken(IsDescription):
> qId=UInt32Col(pos=0)
> qTok=UInt32Col(pos=1)
>
> filename="train.h5"
> titleTrain="train_data"
> h5file = openFile(filename, mode = "w", title=titleTrain)
> root=h5file.root
> group = h5file.createGroup("/", 'Data', "kddDataChunk"+str(chunkId))
> table = h5file.createTable(group, 'dataset', adSuggester, "DatasetChunk
> for")
> groupQuery=h5file.createGroup("/",'queryGrp')
> queryTable=h5file.createTable(groupQuery,'query',queryToken,"Query Table
> for ")
> adSuggester=table.row
> queryToken=table.row
> adSuggester['trId']=trainVals[0] #works
> adSuggester['click']=trainVals[1]
> queryToken['qId']=trainVals[3] # doesnot work
> queryToken['qTok']=trainVals[4]
>
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Pytables-users mailing list
> Pytables-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pytables-users
>
>
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users