[Numpy-discussion] np.genfromtxt StopIteration Error
Stephen P. Molnar
s.molnar at sbcglobal.net
Fri Oct 11 12:41:04 EDT 2019
I have been fighting with the genfromtxt function in numpy for a while
now and am trying a slightly different approach.
Here is the code:
>
> import os
> import glob
> import numpy as np
>
> fileList = []
> filesList = []
>
> for files in glob.glob("*.log"):
> fileName, fileExtension = os.path.splitext(files)
> fileList.append(fileName)
> filesList.append(files)
>
> print('fileList = ', fileList)
> print('filesList = ', filesList)
>
> fname = filesList
> print('fname = ', fname)
> data = np.genfromtxt(fname, usecols=(1), skip_header=27,
> skip_footer=1, encoding=None)
> print(data)
>
> np.savetxt('fileList.dG', data, fmt='%12.9f', header='${d}')
> print(data.dG)
I am using the Spyder IDE which has a variable explorer which shows:
filesList = ['C-VX3.log', '18-7.log', '14-7.log', '15-7.log']
fileList = ['C-VX3', '18-7', '14-7', '15-7']
so the lists that genfromtxt needs are being generated.
Goggling 'numpy genfromtxt stopiteration error' does not seem to address
this problem. At least, I didn't find plaything that I thought applied.
I would greatly appreciate some assistance here.
Thanks is advance.
--
Stephen P. Molnar, Ph.D.
www.molecular-modeling.net
614.312.7528 (c)
Skype: smolnar1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20191011/b501b08a/attachment.html>
More information about the NumPy-Discussion
mailing list