Last active
December 21, 2015 15:59
-
-
Save brantfaircloth/6330209 to your computer and use it in GitHub Desktop.
casting a numpy array of strings to int (examples)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
s = '40 40 40 40 40' | |
sl = s.rstrip().split(' ') | |
si = [int(elem) for elem in sl] | |
sa = numpy.array(si) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
s = '40 40 40 40 40' | |
sa = numpy.array(s.rstrip().split(' ')).astype(int) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment