You should open file by binary mode.
#!/usr/bin/env python3
import numpy as np
f=open('asd.dat','ab')
for iind in range(4):
a=np.random.rand(10,10)
np.savetxt(f,a)
f.close()
reference:
python – How to write a numpy array to a csv file? – Stack Overflow How to write a numpy array to a csv file?
More Related Contents:
- Cannot install NumPy from a wheel format
- Neural network always predicts the same class
- seaborn histplot and displot output doesn’t match
- When importing tensorflow, I get the following error: No module named ‘numpy.core._multiarray_umath’
- Add numpy.get_include() argument to setuptools without preinstalled numpy
- Debugging Numpy VisibleDeprecationWarning (ndarray from ragged nested sequences)
- Could someone please go through this code line by line and explain it in Pseudocode or English
- How to change the location of the column name in pandas?
- Writing a specific function in python
- Rolling window for 1D arrays in Numpy?
- Invalid selector: Compound class names not permitted error using Selenium
- DeprecationWarning: executable_path has been deprecated, please pass in a Service object
- webdriver.FirefoxProfile(): Is it possible to use a profile without making a copy of it?
- python 3.0 open() default encoding
- Make sure that you use the correct version of ‘pip’ installed for your Python interpreter located at ‘dir:\projectPath\venv\Scripts\python.exe’
- scipy curve_fit doesn’t like math module
- TypeError: can’t pickle _thread.lock objects
- Failed to load resource: the server responded with a status of 429 (Too Many Requests) and 404 (Not Found) with ChromeDriver Chrome through Selenium
- “Eager” Page Load Strategy workaround for Chromedriver Selenium in Python
- Convert object data type to string issue in python
- How to replace the icon in a Tkinter app?
- How to click on the anchor element when the spinner obscures it using Selenium and Python?
- Python ModuleNotFoundError while importing a module in conftest for Pytest framework
- Permission Error When Trying to Use PyInstaller
- NumPy style arrays for C++? [closed]
- Append 2D array to 3D array, extending third dimension
- How to retrieve the whole message body using Gmail API (python)
- selenium.common.exceptions.WebDriverException: Message: unknown error: unable to discover open pages using ChromeDriver through Selenium
- Browser Cookie never expires
- How to determine what version of python3 tkinter is installed on my linux machine?