Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Numpy - module has no attribute 'arrange' [closed]

Tags:

python

numpy

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)) 
like image 331
Joey Orlando Avatar asked Aug 27 '15 00:08

Joey Orlando


People also ask

Does NumPy has arrange attribute?

There is no NumPy function named arrange .

What is NP arange in Python?

NumPy arange() is one of the array creation routines based on numerical ranges. It creates an instance of ndarray with evenly spaced values and returns the reference to it. You can define the interval of the values contained in an array, space between them, and their type with four parameters of arange() : numpy.


1 Answers

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

like image 145
DaveQ Avatar answered Oct 07 '22 00:10

DaveQ