0

class_i is an m x n numpy array:

list = []
class_list=[class1,class2,class3,class4,class5,class6,class7]
for class_i in class_list:
   #data processing here
   list_1.append(class_i)

list_1 = np.array(list)

The list_1 numpy array contains the classes as in the form:

[[ 314.5513238  314.4571136  314.2739476 ...      314.6        314.6        314.6      ]
 [ 314.5890785  314.5254568  314.4539721 ...      314.6        314.6        314.6      ]
 [ 314.5886471  314.4992394  314.3350225 ...      314.6        314.6        314.6      ]
 ...     

which is wrong, it does not contain every single value of the numpy classes.

Any way to fix this?

12
  • 5
    I would avoid using list as a variable name to prevent shadowing the built-in list function. And to achieve what you want why not just a = np.array(class_list) Commented Apr 12, 2015 at 15:34
  • this is just an example, there is more processing of data in the for loop Commented Apr 12, 2015 at 15:35
  • What's the shape of list_1? I don't think there's an issue with the append. What do you get with np.array(class_list)? And regarding the ... - that's just a display feature. Commented Apr 12, 2015 at 16:36
  • class_i has shape (52L, 350L) and list_1 has shape (7L,) (wrong) Commented Apr 13, 2015 at 7:37
  • 1
    What shape do you want the output array list_1 to have? The row and column dimensions of the arrays in list do not all match. Commented Apr 16, 2015 at 12:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.