[Numpy-discussion] Np.genfromtxt Problem
Stephen P. Molnar
s.molnar at sbcglobal.net
Fri Oct 4 13:31:34 EDT 2019
I have a snippet of code
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 24 07:51:11 2019
"""
import numpy as np
files = []
data = np.genfromtxt(files, usecols=(3), dtype=None, skip_header=8,
skip_footer=1, encoding=None)
print(data)
If file is a single file the code generates the data that I want.
However I have a list of files that I want to process. According to
numpy.genfromtxt fname can be a "File, filename, list, or generator to
read." If I use [13-7a_apo-1acl.RMSD 13-7_apo-1acl.RMSD
14-7_apo-1acl.RMSD 15-7_apo-1acl.RMSD 17-7_apo-1acl.RMSD ] get the
error:
runfile('/home/comp/Apps/Models/1-PhosphorusLigands/CombinedLigands/MOL/Docking/Results/RMSDTable/Test/DeltaGTable_s.py',
wdir='/home/comp/Apps/Models/1-PhosphorusLigands/CombinedLigands/MOL/Docking/Results/RMSDTable/Test',
current_namespace=True)
Traceback (most recent call last):
File
"/home/comp/Apps/Models/1-PhosphorusLigands/CombinedLigands/MOL/Docking/Results/RMSDTable/Test/DeltaGTable_s.py",
line 12, in <module>
data = np.genfromtxt(files, usecols=(3), dtype=None, skip_header=8,
skip_footer=1, encoding=None)
File
"/home/comp/Apps/Miniconda3/lib/python3.7/site-packages/numpy/lib/npyio.py",
line 1762, in genfromtxt
next(fhd)
StopIteration
I have tried very combination of search terms that I can think of in
order to find an example of how to make this work without success.
How can I make this work?
Thanks in advance.
--
Stephen P. Molnar, Ph.D.
www.molecular-modeling.net
614.312.7528 (c)
Skype: smolnar1
More information about the NumPy-Discussion
mailing list