[Numpy-discussion] .flat (was: add .H attribute?)
Stéfan van der Walt
stefan at sun.ac.za
Tue Jul 23 10:11:47 EDT 2013
On Tue, Jul 23, 2013 at 3:39 PM, Alan G Isaac <alan.isaac at gmail.com> wrote:
> On 7/23/2013 9:09 AM, Pauli Virtanen wrote:
>> .flat which I think
>> is rarely used
>
> Until ``diagonal`` completes its transition,
> use of ``flat`` seems the best way to reset
> the diagonal on an array. Am I wrong?
> I use it that way all the time.
I usually write
x[np.diag_indices_from(x)] = [1,2,3]
Stéfan
More information about the NumPy-Discussion
mailing list