[SciPy-User] itemfreq dtype

Ruggero giurrero at gmail.com
Tue Mar 11 09:30:48 EDT 2014


Dear experts,

I have a sparse array of integers:

x = np.arange(10, dtype=int)

(this is not sparse, but it doesn't matter).

I would like to use itemfreq as

freq = scipy.stats.itemfreq(x)

the problem is that it return float64 Nx2 array.

freq.dtype

 Why this? Why itemfreq is not following the dtype of the input? The
documentation says that bincount works better for integers, the
problem is that I have a sparse array.

What about a dtype(input.dtype, float_64) for the output?

Cheers,
Ruggero



More information about the SciPy-User mailing list