2016-06-21 4 views
0

私のファイルで簡単なpythonプログラムを実行しています。このプログラムは、私のマシンの1台で、ファイルfileA.bedで正常に動作します。しかし、このプログラムは、同じファイルを持つ別のマシンでは動作しません。同じpythonバージョン、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

私はsparse.coo_matrixを作成することによって、このエラーを再現することができます:私は行列が2x3のでなければならないこと、それを言ってますが、列の値の1が3である。ここで、それが必要としててる

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 

[0,3]の範囲(3未満)になります。

あなたのicedパッケージ、または明らかに読み込もうとしているファイルのデータは知りません。しかし、うまくいけば、これはあなたが問題を探す場所を知ることができます。

関連する問題