genfromtxtで、カラム数1のデータをgenfromtxtすると、多次元配列にならない
>>> import numpy as np >>> from StringIO import StringIO >>> data = "1, 2, 3\n4, 5, 6" >>> np.genfromtxt(StringIO(data), delimiter=",") array([[1., 2., 3.], [4., 5., 6.]]) >>> data = "1\n2" >>> np.genfromtxt(StringIO(data), delimiter=",") array([1., 2.]) >>> np.genfromtxt(StringIO(data), delimiter="\n") array([1., 2.])
http://lagrange.univ-lyon1.fr/docs/numpy/1.11.0/user/basics.io.genfromtxt.html