Quoting the isfortran documentation (emphasis mine):
Returns True if the array is Fortran contiguous but not C contiguous.
This function is obsolete and, because of changes due to relaxed stride checking, its return value for the same array may differ for versions of NumPy >= 1.10.0 and previous versions. If you only want to check if an array is Fortran contiguous use a.flags.f_contiguous instead.
There are a few things to note here:
- Your vector is both Fortran and C contiguous, so the function returns false.
- The function is obsolete
There is an alternative way to check the array, that should work for your case:
a = np.zeros((3, 1), order='F')
print(a.flags)
# C_CONTIGUOUS : True
# F_CONTIGUOUS : True
# OWNDATA : True
# WRITEABLE : True
# ALIGNED : True
# UPDATEIFCOPY : False
print(a.flags.f_contiguous)
# True
You cannot edit flags. However, there are a few tricks. For example, you can use transpose to turn a 2D C array into an F array (albeit with swapped dimensions):
print(np.ones((3, 2), order='C').flags)
# C_CONTIGUOUS : True
# F_CONTIGUOUS : False
# ....
print(np.ones((3, 2), order='C').T.flags)
# C_CONTIGUOUS : False
# F_CONTIGUOUS : True
# ....