Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

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()