type code description float or extended-precision floating point complex complex complex complex numbers represented by two or floatsrespectively bool boolean type storing true and false values object python object type string_ fixed-length string type ( byte per characterfor exampleto create string dtype with length use ' unicode_ fixed-length unicode type (number of bytes platform specificsame specification semantics as string_ ( ' 'you can explicitly convert or cast an array from one dtype to another using ndarray' astype methodin [ ]arr np array([ ]in [ ]arr dtype out[ ]dtype('int 'in [ ]float_arr arr astype(np float in [ ]float_arr dtype out[ ]dtype('float 'in this exampleintegers were cast to floating point if cast some floating point numbers to be of integer dtypethe decimal part will be truncatedin [ ]arr np array([ - - ]in [ ]arr out[ ]array( - - ]in [ ]arr astype(np int out[ ]array( - - ]dtype=int should you have an array of strings representing numbersyou can use astype to convert them to numeric formin [ ]numeric_strings np array([' ''- '' ']dtype=np string_in [ ]numeric_strings astype(floatout[ ]array( - ]if casting were to fail for some reason (like string that cannot be converted to float ) typeerror will be raised see that was bit lazy and wrote float instead of np float numpy is smart enough to alias the python types to the equivalent dtypes you can also use another array' dtype attributein [ ]int_array np arange( numpy basicsarrays and vectorized computation www it-ebooks info