Круизная компания MSC Cruises
Морские круизы MSC Cruises: Персидский залив, Красное море, Средиземное море
from rdkit import Chem import pandas as pd suppl = Chem.SDMolSupplier('compounds.sdf')
data = [] for mol in suppl: if mol is not None: # Extract properties (the data fields from the SDF) props = mol.GetPropsAsDict() # Optionally add SMILES string for structure props['SMILES'] = Chem.MolToSmiles(mol) data.append(props) df = pd.DataFrame(data) df.to_csv('compounds.csv', index=False) how to convert sdf file to csv
Within an hour, Elena handed Leo the final compounds.csv . He opened it in Excel: columns neatly aligned, hundreds of compounds ready for analysis. from rdkit import Chem import pandas as pd suppl = Chem
Here’s a short, instructive story that walks through the process of converting an SDF file to CSV, written in a practical, narrative style. The Molecular Mix-Up The Molecular Mix-Up “For the non-programmers on our
“For the non-programmers on our team,” Elena continued, “we use KNIME. Drag an ‘SDF Reader’ node, connect it to a ‘CSV Writer’ node, and configure which columns to keep. It’s visual—like drawing a flowchart.”
“That’s it. But it gives you a limited set of default columns. If you want specific properties, you add -x options.”
“Ah,” Elena pointed. “Classic SDF problem. Not every molecule has the same set of properties. Pandas handles that by filling blanks with NaN . Open Babel will leave empty cells. The lesson: after conversion.”