Maneira eficiente de adicionar uma dimensão singleton a um vetor NumPy para que as atribuições de fatia funcionem

No NumPy, como você pode transformar eficientemente um objeto 1-D em um objeto 2-D onde a dimensão singleton é inferida a partir do objeto atual (ou seja, uma lista deve ir para um vetor 1xlength ou lengthx1

 # This comes from some other, unchangeable code that reads data files.
 my_list = [1,2,3,4]

 # What I want to do:
 my_numpy_array[some_index,:] = numpy.asarray(my_list)

 # The above doesn't work because of a broadcast error, so:
 my_numpy_array[some_index,:] = numpy.reshape(numpy.asarray(my_list),(1,len(my_list)))

 # How to do the above without the call to reshape?
 # Is there a way to directly convert a list, or vector, that doesn't have a
 # second dimension, into a 1 by length "array" (but really it's still a vector)?

questionAnswers(10)

yourAnswerToTheQuestion