These are chat archives for numpy/numpy

28th
Jun 2017
Benno Fünfstück
@bennofs
Jun 28 2017 15:16
@njsmith @juliantaylor hmm, both give "float64" for np.zeros((4,4)). I would like to get the dtype that represents a 4x4 float array though for that type
basically, I am given a parameter x that may be an array or a scalar and I want to make an array that can store values of the same type as x
I also tried np.full((1,1), x) but that gives "could not broadcast input array from shape (4,4) into shape (1,1)" for a 4x4 array x
Nathan Goldbaum
@ngoldbaum
Jun 28 2017 15:42
if it's already an array, you can look at array.dtype
unless you're talking about storing the array object in another array, which is kinda weird
Benno Fünfstück
@bennofs
Jun 28 2017 16:48
@ngoldbaum i want to store the array object in another array, yes
Nathan Goldbaum
@ngoldbaum
Jun 28 2017 18:11
then i think it will always be dtype='object'
there is likely an alternate approach that doesn't require object arrays
but i don't know what you're doing