Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python np.c_ error"CClass object is not callabel"

Tags:

python

numpy

I'm using ipython 4.0.1 and python 3.5.1, when I call np.c_(), it shows an error

CClass object is not callable.

This is my code:

import numpy as np


rows = []
with open('ntumlone.dat') as f:
    rows = [list(map(float, L.split())) for L in f]

arr = np.array(rows)

date = np.c_(np.ones(len(arr)), arr)

What's wrong with me?

like image 838
tian tong Avatar asked Dec 27 '15 11:12

tian tong


1 Answers

Try

date = np.c_[np.ones(len(arr)), arr]

Check its docs. You 'call' it with square brackets, as though you are indexing, not with (). If the distinction is too confusing stick with concatenate or one of the stack functions. I think in this use it is the same as vstack.

like image 134
hpaulj Avatar answered Nov 02 '22 00:11

hpaulj