Numpy - Module Has No Attribute 'Arrange' [Closed]

Numpy - Module Has No Attribute 'Arrange' [Closed]

Seems like an incredibly basic error, I've tried uninstalling and reinstalling the latest version of Numpy (1.9) and that didn't seem to solve my issue. I am getting the following error when trying to use the arrange function:

Traceback (most recent call last):
  File "names.py", line 37, in <module>
    top1000.index = np.arrange(len(top1000))
AttributeError: 'module' object has no attribute 'arrange'

Printing the version confirms that it is indeed 1.9. I've not been able to come across anyone else reporting this specific issue. I've also tried this on two separate Macs and still get the same exact error.

import numpy as np
import pandas as pd

print np.__version__

grouped = names.groupby(['year', 'sex'])
top1000 = grouped.apply(get_top1000)
top1000.index = np.arrange(len(top1000))
9

1 Answer

You should try numpy.arange() instead, if that is what you meant?

5
Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.