Changing flag of ndarray in numpy
numpy.ndarray.setflags(write=None, align=None, uic=None)
write : bool, optional
align : bool, optionalDescribes whether or not a can be written to.
uic : bool, optionalDescribes whether or not a is aligned properly for its type.
Array flags provide information about how the memory area used for the array is to be interpreted. There are 6 Boolean flags in use, only three of which can be changed by the user: UPDATEIFCOPY, WRITEABLE, and ALIGNED.Describes whether or not a is a copy of another “base” array.
WRITEABLE (W) the data area can be written to;
ALIGNED (A) the data and strides are aligned appropriately for the hardware (as determined by the compiler);
UPDATEIFCOPY (U) this array is a copy of some other array (referenced by .base). When this array is deallocated, the base array will be updated with the contents of this array.
**All flags can be accessed using their first (upper case) letter as well as the full name.**
Example:
>>> y array([[3, 1, 7], [2, 0, 0], [8, 5, 9]]) >>> y.flags C_CONTIGUOUS : True F_CONTIGUOUS : False OWNDATA : True WRITEABLE : True ALIGNED : True UPDATEIFCOPY : False >>> y.setflags(write=0, align=0) >>> y.flags C_CONTIGUOUS : True F_CONTIGUOUS : False OWNDATA : True WRITEABLE : False ALIGNED : False UPDATEIFCOPY : False >>> y.setflags(uic=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: cannot set UPDATEIFCOPY flag to True
source: scipy.org
Thanks for sharing this blog.This article gives lot of information.
ReplyDeletePython Training in Hyderabad
Python Training
Python Online Training
ReplyDeleteIt is very useful.Thanks for sharing.
Thank you for sharing such great information very useful to us.
oracle training in chennai
oracle training institute in chennai
oracle training in bangalore
oracle training in hyderabad
oracle training
hadoop training in chennai
hadoop training in bangalore