IndexError: index 0 is out of bounds for axis 0 with size 0
<p>I am trying to write a code to divide two polynomials given in binary form (newdata and proofin, respectively). When I run the code, however, I get:</p>

<pre><code>IndexError: index 0 is out of bounds for axis 0 with size 0
</code></pre>

<p>This is the code:</p>

<pre><code>import numpy as np


def transformation_for_numpy_of_o():
    newdata = ("101001")
    freshdata = list(newdata)
    freshdatapoly = []

    for n in freshdata:
        if n == 1:
            freshdatapoly.append(1.0)
        if n == 0:
            freshdatapoly.append(0.0)

    freshdatapoly = np.array(freshdatapoly)

    return freshdatapoly


def transformation_for_numpy_of_proof():
    proofin = ("101001")
    proofing = list(proofin)
    proofpoly = []

    for n in proofing:
        if n == 1:
            proofpoly.append(1.0)
        if n == 0:
            proofpoly.append(0.0)

    proofpoly = np.array(proofpoly)

    return proofpoly


def total():
    # Based on http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.polydiv.html

    o_transformed = transformation_for_numpy_of_o()
    proof_transformed = transformation_for_numpy_of_proof()

    numer = np.array(o_transformed)
    denomin = np.array(proof_transformed)
    answer = np.polydiv(numer, denomin)

    print (answer)

total()
</code></pre>

<p>I am new to numpy and don't understand this error. How can I fix this?</p>

<hr>

<p>*EDIT: Entire Traceback, as requested:</p>

<pre><code>/Users/M/anaconda/envs/Invictus/bin/python/Users/Max/PycharmProjects/1/Origin
Traceback (most recent call last):
  File "/Users/M/PycharmProjects/1/Origin", line 49, in &lt;module&gt;
    total()
  File "/Users/M/PycharmProjects/1/Origin", line 46, in total
    answer = np.polydiv(numer, denomin)
  File "/Users/M/anaconda/envs/Invictus/lib/python3.5/site-packages/numpy/lib/polynomial.py", line 895, in polydiv
    w = u[0] + v[0]
IndexError: index 0 is out of bounds for axis 0 with size 0
Process finished with exit code 1
</code></pre>