nikki
nikki

Reputation: 353

Error: 'float' object cannot be interpreted as an index

I am trying to run the following code from this repository.

https://github.com/UjjwalSaxena/Automold--Road-Augmentation-Library

hp.visualize(images, column=3, fig_size=(20,10))

It gives me following error. How can I fix this?

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "Helpers.py", line 51, in visualize
    f,axes= plt.subplots(row, column, figsize=fig_size)
  File "/home/.local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 1187, in subplots
    gridspec_kw=gridspec_kw)
  File "/home/.local/lib/python2.7/site-packages/matplotlib/figure.py", line 1362, in subplots
    axarr = np.empty((nrows, ncols), dtype=object)
TypeError: 'float' object cannot be interpreted as an index

Upvotes: 0

Views: 165

Answers (1)

AzyCrw4282
AzyCrw4282

Reputation: 7744

I believe the repo that you are trying to use requires Python3.x(though it's not explicitly mentioned anywhere ) and you seem to be using Python2.7.

The error

TypeError: 'float' object cannot be interpreted as an index

seems to me that one of the parameters in the line is passing a float value as an index which is not accepted in Python2.x and will be fine in Python3.x.

Simply use Python3.x and it should solve your problem.

Upvotes: 1

Related Questions