only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
<p>I am implementing fft as part of my homework. My problem lies in the implemention of shuffling data elements using bit reversal. I get the following warning:</p>
<blockquote>
<p>DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future.</p>
<p>data[x], data[y] = data[y], data[x]</p>
</blockquote>
<p>And the auto grading system (provided by university) returns the following:</p>
<blockquote>
<p>error: only integers, slices (<code>:</code>), ellipsis (<code>...</code>), numpy.newaxis (<code>None</code>) and integer or boolean arrays are valid indices.</p>
</blockquote>
<p>My code is:</p>
<pre><code>def shuffle_bit_reversed_order(data: np.ndarray) -&gt; np.ndarray:
    &quot;&quot;&quot;
    Shuffle elements of data using bit reversal of list index.

    Arguments:
    data: data to be transformed (shape=(n,), dtype='float64')

    Return:
    data: shuffled data array
    &quot;&quot;&quot;

    # implement shuffling by reversing index bits

    size = data.size

    half = size/2;

    for x in range(size):
        xx = np.int(x)
        n = np.int(half)

        y = 0

        while n &gt; 0:
            y += n * np.mod(xx,2)
            n /= 2
            xx = np.int(xx /2)

        if (y &gt; x):

            data[x], data[y] = data[y], data[x]

    return data
</code></pre>
<p>I have already implemented the function for fft but it won't work until I get this shuffling function working. I think the problem is my data is of type 'float64' and I may have used it as an integer but I don't know how I can solve it.</p>