<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I have been fighting with the genfromtxt function in numpy for a
while now and am trying a slightly different approach.<br>
<br>
Here is the code:<br>
<br>
<blockquote type="cite"><br>
import os<br>
import glob<br>
import numpy as np<br>
<br>
fileList = []<br>
filesList = []<br>
<br>
for files in glob.glob("*.log"):<br>
?????? fileName, fileExtension = os.path.splitext(files)<br>
?????? fileList.append(fileName)<br>
?????? filesList.append(files)<br>
<br>
print('fileList = ', fileList)<br>
print('filesList = ', filesList)<br>
<br>
fname = filesList<br>
print('fname = ', fname)<br>
data = np.genfromtxt(fname, usecols=(1), skip_header=27,
skip_footer=1, encoding=None)<br>
print(data)<br>
<br>
np.savetxt('fileList.dG', data, fmt='%12.9f', header='${d}')<br>
print(data.dG)<br>
</blockquote>
I am using the Spyder IDE which has a variable explorer which shows:<br>
<br>
<meta name="qrichtext" content="1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
p, li { white-space: pre-wrap; }
</style>filesList = ['C-VX3.log', '18-7.log', '14-7.log', '15-7.log']<br>
fileList = ['C-VX3', '18-7', '14-7', '15-7']<br>
<br>
so the lists that genfromtxt needs are being generated.<br>
<br>
Goggling 'numpy genfromtxt stopiteration error' does not seem to
address this problem. At least, I didn't find plaything that I
thought applied.<br>
<br>
I would greatly appreciate some assistance here.<br>
<br>
Thanks is advance.<br>
<pre class="moz-signature" cols="72">--
Stephen P. Molnar, Ph.D.
<a class="moz-txt-link-abbreviated" href="http://www.molecular-modeling.net">www.molecular-modeling.net</a>
614.312.7528 (c)
Skype: smolnar1
</pre>
</body>
</html>