Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C , Python, Incompatible Types of Numbers
- class_<std::vector<double> >("PyVecDouble")
- .def(vector_indexing_suite<std::vector<double> >());
- class_<std::vector<long> >("PyVecLong")
- .def(vector_indexing_suite<std::vector<long> >());
- def NumpyArrayToPyVecDouble(vec):
- n = len(vec)
- p_vec = jp.PyVecDouble()
- for i in xrange(0,n):
- p_vec.append(vec[i])
- return p_vec
- def NumpyArrayToPyVecLong(vec):
- n = len(vec)
- p_vec = jp.PyVecLong()
- for i in xrange(0,n):
- p_vec.append(vec[i])
- return p_vec
- example_array = np.array([1.1, 2.2, 3.3, 4.4])
- example = NumpyArrayToPyVecDouble(double_array)
- dates_array = np.array([01122011, 01062012, 01122012, 01062013])
- dates = NumpyArrayToPyVecLong(dates_array)
- TypeError: Attempting to append an invalid type
Add Comment
Please, Sign In to add comment