Python Spliting extracted CSV Data -
i have info (taken csv file) in format:
myvalues = [[2 2 2 1 1] [2 2 2 2 1] [1 2 2 1 1] [2 1 2 1 2] [2 1 2 1 2] [2 1 2 1 2] [2 1 2 1 2] [2 2 2 1 1] [1 2 2 1 1]]
i split info 2/3 , 1/3 , able distinguish between them. example
twothirds = [[2 2 2 1 1] [2 2 2 2 1] [1 2 2 1 1] [2 1 2 1 2] [2 1 2 1 2] [2 1 2 1 2]] onethird = [[2 1 2 1 2] [2 2 2 1 1] [1 2 2 1 1]]
i have tried utilize next code accomplish this, unsure if have gone right way?
twothirds = (myvalues * 2) / 3 #what code provide me?
it's list, utilize piece notation. , read docs:
in [59]: l = range(9) in [60]: l[:len(l)/3*2] out[60]: [0, 1, 2, 3, 4, 5] in [61]: l[len(l)/3*2:] out[61]: [6, 7, 8]
python csv split
No comments:
Post a Comment