[Numpy-discussion] Deleting a row from a matrix
Travis Oliphant
oliphant.travis at ieee.org
Fri Aug 25 19:04:57 CDT 2006
Keith Goodman wrote:
> On 8/25/06, Travis Oliphant <oliphant.travis at ieee.org> wrote:
>
>
>> I've come up with adding the functions (not methods at this point)
>>
>> deletefrom
>> insertinto
>>
>> appendto (syntatic sugar for concatenate but with a separate argument
>> for the array and the extra stuff) --- is this needed?
>>
>> These functions will operate along a particular axis (default is axis=0
>> to match concatenate).
>>
>
> It is probably obvious to everyone except me: what is the syntax?
>
No, I'm sure it isn't obvious to anyone.
Here's what I'm implementing (I'm using the default axis=None now which
I like because it's consistent with everything else and it forces you to
pick an axis for >1d arrays --- this also gives some purpose for the
appendonto function)
deletefrom(arr, obj, axis=None) where obj is either an integer, a slice
object, or a sequence of integers indicating the rows to delete:
> If x is 5x5 and I want to delete rows 2 and 4 is it deletfrom(x, [1,3], axis=0)?
>
Yes, if you are counting from 1.
-Travis
More information about the Numpy-discussion
mailing list