Hi again,

Since I thought it might be a Colab problem I also posted the question on 
Stackoverflow, and got an answer from Oliver Scott
https://stackoverflow.com/questions/58656572/problem-using-addmoleculecolumntoframe-on-google-colab/58690736#58690736

"Seems like this is a problem with all pandas versions above 0.25.0, So I guess 
for now the easiest fix is to downgrade pandas. Or you can use this method 
which seemed to work for me:


from IPython.display import HTML
HTML(df.to_html())

I haven’t managed to downgrade pandas on Colab (almost certainly a Colab issue) 
but the other workaround works fine.

Best regards, Jan

On 4 Nov 2019, at 19.47, Markus Heller 
<mhel...@admarebio.com<mailto:mhel...@admarebio.com>> wrote:

Hi,

In a Jupyter notebook, the following code does not show renderings of the 
molecules in a Pandas dataframe:

<code>
from rdkit import Chem
from rdkit.Chem import PandasTools
from rdkit.Chem.Draw import MolsToGridImage
from rdkit.Chem.Draw import IPythonConsole
from rdkit.Chem import rdDepictor

rdDepictor.SetPreferCoordGen(True)
IPythonConsole.ipython_useSVG = True

test_df = pd.read_csv(‘test.smi’, delim_whitespace=True, header=None, 
names=[‘smiles’, ‘id’])

PandasTools.RenderImagesInAllDataFrames(images=True)

PandasTools.AddMoleculeColumnToFrame(test_df, ‘smiles’, ‘mol’, 
includeFingerprints=False)

test_df
</code>

Instead, string representations are shown (I think), i.e. every field in the 
mol column starts with

<img src=”data:image/png;base64…”

As far as I understand the documentation, 
PandasTools.RenderImagesInAllDataFrames(images=True) should show the rendered 
molecules.  What am I doing wrong?

I’m using RDkit version 2019.03.4.0 via Anaconda.

Thanks
Markus

--
Markus Heller, PhD
Senior Scientist
Direct: 604.827.1122   Main: 604.827.1147

 <image001.png>
2405 Wesbrook Mall, 4th Floor, Vancouver, BC V6T 1Z3

This email and any attachments thereto may contain confidential material for 
the sole use of the intended recipient. Anyreview, copying, or distribution of 
this email (or any attachments thereto) by others is strictly prohibited. If 
you are not theintended recipient, please contact the sender immediately and 
permanently delete the original and any copies of this emailand any attachments 
thereto.

_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net<mailto:Rdkit-discuss@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to