arrays - Weird lines in python file, can't extract column -


  0 0: 1   0 1: 1   0 1: 0   1 0: 0 

i have file, looks above.

i trying extract columns arrays using numpy.loadtxt of python. ideally, want many arrays, or @ least data structure in arrays [0,0,0,1], [0,1,1,0]. utter discomfort, because there semicolon after second number, i'm unable use numpy.loadtxt. have solutions how either surpass that, or remove semicolon without having separate file?

np.loadtxt(file, converters = {1: lambda s: int(s.strip(":"))}) 

from numpy.loadtxt:

converters : dict, optional
dictionary mapping column number function convert column float. e.g., if column 0 date string: converters = {0: datestr2num}. converters can used provide default value missing data (but see genfromtxt): converters = {3: lambda s: float(s.strip() or 0)}. default: none.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -