numpy.isfortran () in Python

NumPy | Python Methods and Functions

Order: [C-adjacent, F-adjacent, A-adjacent; optional]

C-contiguous order in memory (last index changes the fastest). The C-order means that the operation of lifting up a string in an array will be slightly faster. 
FORTRAN-contiguous order in memory (the first index changes the fastest). The F order means that operations on the columns will be faster. 
"A" means read / write elements in Fortran-like index order if the array is contiguous in Fortran memory, otherwise — in order like C.

Parameters :

  array:  [array_like] Input array 

Return:

 True, if array is Fortran; else False 

Code 1:

# Python program explaining
# isfortran () function

import numpy as np

 

in_array = np.array ([[ 1 , 2 , 3 ], [ 4 , 5 , 6 ]], order = `C` )

print ( "Input array:" , in_array)

 

exp2_values ​​ = np.exp2 (in_array)

print ( "isfortran:" , np.isfortran (in_array))

Output:

 Input array: [[1 2 3] [4 5 6]] isfortran : False 

Code 2:

# Python program explaining
# isfortran () function

import numpy as np

 

in_ar ray = np.array ([[ 1 , 2 , 3 ], [ 4 , 5 , 6 ]], order = `F` )

print ( " Input array: " , in_array)

 

exp2_values ​​ = np.exp2 (in_array)

print ( " isfortran: " , np.isfortran (in_arra y))

Output:

 Input array: [[1 2 3] [4 5 6]] isfortran: True 

Links:
https://docs.scipy.org/doc/numpy-1.13.0/reference /generated/numpy.isfortran.html#numpy.isfortran
,





Get Solution for free from DataCamp guru