The idea is that there be a short-hand for creating arrays as there is for
matrices:

  np.mat('.2 .7 .1; .3 .5 .2; .1 .1 .9')

It was suggested in GitHub issue #4817
<https://github.com/numpy/numpy/issues/4817> in light that it would be
beneficial to beginners and to presenters during demonstrations.  In GitHub
pull request #484 <https://github.com/numpy/numpy/pull/4845>, I implemented
this as the np.arr function.

Does anyone have any feedback on the API details? Some examples from my
implementation follow.

>>> np.arr('3; 4; 5')
    array([[3],
           [4],
           [5]])

>>> np.arr('3; 4; 5', dtype=float)
    array([[ 3.],
           [ 4.],
           [ 5.]])

>>> np.arr('1 0 0; 0 1 0; 0 0 1')
    array([[1, 0, 0],
           [0, 1, 0],
           [0, 0, 1]])

>>> np.arr('4, 5; 6, 7')
    array([[4, 5],
           [6, 7]])
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to