NumPy: asfortranarrray() function
numpy.asfortranarrray() function
The asfortranarrray() function is used to get an array laid out in Fortran order in memory.
Syntax:
numpy.asfortranarray(a, dtype=None)
Version: 1.15.0
Parameter:
Name | Description | Required / Optional |
---|---|---|
a | Input array. | Required |
dtype | By default, the data-type is inferred from the input data. | Optional |
Return value:
out : ndarray The input a in Fortran, or column-major, order.
Example: numpy.asfortranarrray()
>>> import numpy as np
>>> a = np.arange(9).reshape(3,3)
>>> b = np.asfortranarray(a)
>>> a.flags['F_CONTIGUOUS']
False
>>> b.flags['F_CONTIGUOUS']
True
Python - NumPy Code Editor:
Previous: asfarray()
Next: ascontiguousarray()
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework