From 42a530792d7df73752dc156ea02cc23ecd61c844 Mon Sep 17 00:00:00 2001 From: "Kim, Hyean Sung" Date: Wed, 18 Aug 2021 13:29:16 +0900 Subject: [PATCH 1/2] to_dic bug fixed Some data in Pubchem does not provides compound value while other data source provides. In this case, to_dataframe or to_dict funtion generate error no "compound" ex: substance search with "pcp.get_substances("65983-31-5", "name")" --- pubchempy.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pubchempy.py b/pubchempy.py index 8de112f..c2656f3 100644 --- a/pubchempy.py +++ b/pubchempy.py @@ -1113,10 +1113,16 @@ def standardized_cid(self): May not exist if this Substance was not standardizable. """ + """ + Some substances of pubchem data doesnot provide compound key for c in self.record['compound']: if c['id']['type'] == CompoundIdType.STANDARDIZED: return c['id']['id']['cid'] - + """ + if 'compound' in self.record: + for c in self.record['compound']: + if c['id']['type'] == CompoundIdType.STANDARDIZED: + return c['id']['id']['cid'] @memoized_property def standardized_compound(self): """Return the :class:`~pubchempy.Compound` that was produced when this Substance was standardized. From 31985558bff01b34eb46e17edbc66d3031bb246d Mon Sep 17 00:00:00 2001 From: "Kim, Hyean Sung" Date: Wed, 18 Aug 2021 14:29:39 +0900 Subject: [PATCH 2/2] add --- docs/source/guide/contribute.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/guide/contribute.rst b/docs/source/guide/contribute.rst index 69a1446..7523692 100644 --- a/docs/source/guide/contribute.rst +++ b/docs/source/guide/contribute.rst @@ -18,6 +18,7 @@ Contributors - |ghi| `llazzaro `_ (Leonardo Lazzaro) - |ghi| `bjodah `_ (Björn Dahlgren) - |ghi| `RickardSjogren `_ (Rickard Sjögren) +- |ghi| `Hyeansung `_ (Kim, Hyeonsung) .. _`source code`: https://github.com/mcs07/PubChemPy .. _`Issue Tracker`: https://github.com/mcs07/PubChemPy/issues