RDKit Fingerprint Bitvector Read as Series in Python Script

Hi,

I am using an RDKit Fingerprint node to generate a bit vector for a SMILES column.  This is successful and I see in the output table that my column type is "Bit vector" for the generated fingerprint.  I am then feeding the table into a Python Script node but when I run the below Python script the Type shows up as Series (see attachment).

fp = input_table['SMILES (RDKit Mol) (Fingerprint)']

Is there a way to force the data type to stay a bit vector?  Ultimately what I want to do is use the RDKit ConvertToNumpyArray function which needs an ExplicitBitVect data type.

Thanks,

Troy

The python snippet operates on the whole table compared to the Java snippet that only takes 1 row at a time. Series is the name for a column in a pandas DataFrame. So in your example

fp = input_table['SMILES (RDKit Mol) (Fingerprint)']

fp is a series that contains all rows. To get the first row use:

fp = input_table['SMILES (RDKit Mol) (Fingerprint)'][0]

 

Thanks beginner_ !  Didn't realize the difference, I haven't used Python much with KNIME.

-Troy

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.