2016-06-21 2 views
0

내 파일이있는 간단한 파이썬 프로그램을 실행하고 있습니다. 이 프로그램은 내 컴퓨터에서 fileA.bed 파일로 잘 작동합니다. 그러나이 프로그램은 같은 파일을 가진 다른 컴퓨터에서는 작동하지 않습니다. 동일한 파이썬 버전, 2.7.6, 동일한 필수 모듈, scipy ('0.15.1'), numpy ('1.8.2'), 아이스 ('0.2.2-git') (두 시스템 모두 동일한 버전)를 설치했습니다. 오류 메시지는 ValueError: column index exceeds matrix dimensions에 관한 것입니다 (아래 참조). 이 문제를 일으킬 수있는 원인을 알려주십시오.python ValueError : 열 인덱스가 행렬 크기를 초과합니다.

python Dense.py -b fileA.bed 

Traceback (most recent call last): 
    File "Dense.py", line 34, in <module> 
    counts = io.load_counts(args.filename, lengths=lengths) 
    File "$PATH/Python-2.7.6/venv_iced_2.2/lib/python2.7/site-packages/iced/io/_io_else.py", line 30, in load_counts 
    counts = sparse.coo_matrix((X[:, 2], (X[:, 0], X[:, 1])), shape=shape) 
    File "$PATH/Python-2.7.6/venv_iced_2.2/lib/python2.7/site-packages/scipy/sparse/coo.py", line 206, in __init__ 
    self._check() 
    File "$PATH/Python-2.7.6/venv_iced_2.2/lib/python2.7/site-packages/scipy/sparse/coo.py", line 262, in _check 
    raise ValueError('column index exceeds matrix dimensions') 
ValueError: column index exceeds matrix dimensions 

답변

1

I는 sparse.coo_matrix로 만들어이 오류를 재현 할 수

In [1075]: sparse.coo_matrix(([1,1,1],([0,1,1],[0,1,3])), shape=(2,3)) 
--------------------------------------------------------------------------- 
ValueError        Traceback (most recent call last) 
<ipython-input-1075-40a6338a3244> in <module>() 
----> 1 sparse.coo_matrix(([1,1,1],([0,1,1],[0,1,3])), shape=(2,3)) 

/usr/lib/python3/dist-packages/scipy/sparse/coo.py in __init__(self, arg1, shape, dtype, copy) 
    180    self.data = self.data.astype(dtype) 
    181 
--> 182   self._check() 
    183 
    184  def getnnz(self, axis=None): 

/usr/lib/python3/dist-packages/scipy/sparse/coo.py in _check(self) 
    236     raise ValueError('row index exceeds matrix dimensions') 
    237    if self.col.max() >= self.shape[1]: 
--> 238     raise ValueError('column index exceeds matrix dimensions') 
    239    if self.row.min() < 0: 
    240     raise ValueError('negative row index found') 

ValueError: column index exceeds matrix dimensions 

I가 말하고 행렬이되어야한다는의 2x3, 그러나 열 값 중 하나가 어디대로한다 3 [0,3] 범위에 있어야합니다 (3보다 작음).

iced 패키지 또는 분명히로드하려는 파일의 데이터에 대해 알지 못합니다. 하지만이 방법을 사용하면 문제를 검색 할 위치를 알 수 있습니다.

관련 문제