简体   繁体   中英

Python reading file and then converting into Matrix

lets say I have one file in CSV, which has two columns, first column contains the image values in integer ie, 28 x 28, and second column has label. How an I read this file. numpy.load and numpy.loadtxt both fails. I have to read column 1 and then convert into array of 784.

Thank you everyone who responded in comment section. My problem is solved by following code

Y = numpy.genfromtxt('training.csv',delimiter= " ",dtype=numpy.uint8);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM