[Tutor] Why Doesn't the for loop Increment?

Mats Wichmann mats at wichmann.us
Tue Jan 12 14:57:24 EST 2021


On 1/12/21 12:32 PM, Stephen P. Molnar wrote:
> Python3.7.3 on Debian Buster.
> 
> I have a large number of computational docking files from which I wish 
> to extract results.
> 
> I have cobbled together a script that works, up to a point:
> 
> #!/usr/bin/env python3
> # -*- coding: utf-8 -*-
> import pandas as pd
> import numpy as np
> 
> df = pd.read_csv('ligands_3')
> num = [1,2,3,4,5,6,7,8,9,10]
> 
> for ligand in df:
...
> For each ligand I run ten repetitions of the docking. The ligands_3 file 
> contains three ligand names:
> 
> 7-Phloroeckol
> Aloeemodin
> beta-Sitosterol
...
> The problem, though, is that the script does not go on to the next 
> ligand in the list. Everything that I have found in Google results says 
> that the script will iterate through the list.
> 
> What have I done or not done?

you're reading as a csv and trying to create a dataframe. are you 
getting what you expect?

print out what df is before you start using it.


More information about the Tutor mailing list