GeezerVison is showing github.com — add flags attribute and thier sub attributes program · deepdalsania/tutorials@55eff24
File tree
Expand file treeCollapse file tree
Open diff view settings
python-numpy/Python_NumPy/npbasic
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboard +24Lines changed: 24 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import numpy as np |
| 2 | + |
| 3 | +# Information about the memory layout of the array. |
| 4 | + |
| 5 | +# The flags object can be accessed dictionary-like (as in a.flags['WRITEABLE']), or by using |
| 6 | +# lowercased attribute names (as in a.flags.writeable). Short flag names are only supported |
| 7 | +# in dictionary access. |
| 8 | + |
| 9 | +a = np.arange(10) |
| 10 | +# The data is in a single, C-style contiguous segment |
| 11 | +print("Flags Attribute C_CONTIGUOUS : ",a.flags.c_contiguous) |
| 12 | +# The data is in a single, Fortran-style contiguous segment |
| 13 | +print("Flags Attribute F_CONTIGUOUS : ",a.flags.f_contiguous) |
| 14 | +# The array owns the memory it uses or borrows it from another object |
| 15 | +print("Flags Attribute OWNDATA : ",a.flags.owndata) |
| 16 | +# The data area can be written to. Setting this to False locks the data, making it read-only |
| 17 | +print("Flags Attribute WRITEABLE : ",a.flags.writeable) |
| 18 | +# The data and all elements are aligned appropriately for the hardware |
| 19 | +print("Flags Attribute ALIGNED : ",a.flags.aligned) |
| 20 | +# This array is a copy of some other array. When this array is deallocated, the base array |
| 21 | +# will be updated with the contents of this array |
| 22 | +print("Flags Attribute WRITEBACKIFCOPY : ",a.flags.writebackifcopy) |
| 23 | + |
| 24 | + |