Essentially I'm reading a csv file containing a bunch of chemical compounds and I'm trying to apply the pubchempy.get_properties function to the CID column that contains the CID (identifier) number of each of the chemical compounds.
However, I can't get it to work. The weird thing is I'm not getting any errors (I did get some initially and kind of tinkered with it to try to fix them), it's just that the column(CID) values are remaining the same and are not changing after the function runs.
This is the code I've written for now:
import pandas as pd
import pubchempy
df = pd.read_csv("Chemical datavase.tsv.txt", sep="\t")
pd.set_option('display.width', 1000)
pd.set_option('display.max_columns', 12)
pd.set_option('display.max_rows', 12)
from pubchempy import get_compounds, Compound, get_properties
if (df['CID']>0).all():
df['CID'] = pubchempy.get_properties(df['CID'], 'MolecularWeight')
print(df['CID'])
I'd appreciate any help on this!