Change language

numpy.isfortran () in Python

|

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
,

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

News


Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method