rdkit: Error when import PandasTools

Describe the bug When I import PandasTools, I get the error message:

Failed to find the pandas get_adjustment() function to patch
Failed to patch pandas - PandasTools will have limited functionality

Then when I reproduce the gist https://gist.github.com/greglandrum/3b9da87a20e9b0d4827bbf1e64f68056 the molecule column isn’t rendered: image

Configuration (please complete the following information):

  • RDKit version: 2023.09.4 and 2023.09.5
  • OS: MacOS Ventura 14.3 and Ubuntu 22.04 under WSL2
  • Python version (if relevant): 3.12
  • Are you using conda? mamba
  • If you are using conda, which channel did you install the rdkit from? conda-forge
  • If you are not using conda: how did you install the RDKit? N/A

Additional context The pandas version installed as part of the rdkit env is 2.2.0.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (6 by maintainers)

Commits related to this issue

Most upvoted comments

That’s what I did in the end, and it works, pandas=2.1. Just wanted to add some weight to @martinj80’s suggestion that applying the patch as outlined by @ptosco in https://github.com/rdkit/rdkit/issues/7159#issuecomment-1971637963 is not enough.

The problem is you have a new version Pandas that RDKit does not know how to patch(work with). Downgrade the pandas to a version that RDKit is familiar with or upgrade RDKit if greglandrum does something to RDKit. For example, my RDKit is ‘2023.09.5’ and it does not work with version 2.2.2 of Pandas. So I downgrade Pandas to 2.0.0. (I use the trial-and-error method to know which version works)

pip install pandas==2.0.0

@ptosco Thank you for the response.

I applied the patch file already, but for some reason it did not help 100% (before the error message was different though). Only after I modified the lines I pointed out in my post it worked without errors.

@DavidACosgrove Ouch, it looks like something has changed in the pandas module. I’ll look into fixing it - thanks for reporting the problem.