I run the following in Python 2.7
import numpy
a = numpy.ndarray(shape=(2,2), dtype=float, order='F')
print numpy.mean(a)
numpy.savetext('foo.txt', a)
and get this result
[me@foo bar]$ python f.py
8.79658981512e-317
Traceback (most recent call last):
File "f.py", line 4, in <module>
numpy.savetext('foo.txt', a)
AttributeError: 'module' object has no attribute 'savetext'
What's wrong?
There are two ways to install numpy: Install the binary (pre-compiled) version using pip. Compile it from source code, and then install it.
The array object in NumPy is called ndarray . We can create a NumPy ndarray object by using the array() function.
It's numpy.savetxt
, without the e
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With