[Numpy-discussion] create numerical arrays from strings

Alan G Isaac alan.isaac at gmail.com
Thu Feb 6 08:46:49 EST 2014

NumPy matrix construction includes as a convenience feature
the construction of matrices with a Matlab-like syntax.
E.g., np.mat('1 2;3 4').

Is it correct that this syntax is not supported for
direct (i.e., not using `mat`) ndarray creation?

You may ask, where would this possibly matter?
The answer: in the undergraduate classroom.

Compare np.mat('1 2; 3 4')
to np.array([[1, 2], [3, 4]])
for readability and intimidation factor.
Little things matter when getting started
with students who lack programming background.

Alan Isaac

More information about the NumPy-Discussion mailing list