[Python-ideas] fancy indexing (original) (raw)
Sturla Molden sturla at molden.no
Tue Jul 20 22:07:21 CEST 2010
- Previous message: [Python-ideas] 'where' statement in Python?
- Next message: [Python-ideas] 'where' statement in Python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Den 20.07.2010 20:16, skrev Guido van Rossum:
Yes, it is roughtly like a WHERE statement in SQL or Fortran 90, or Python's built-in "filter" function (albeit more flexible).
Fancy indexing is actually more like a join. Since the result from a numpy.where one array can be used to filter another array, it fancy indexing would be like a join between tables in a relational database.
def join(blist, index): return [blist[i] for i in index]
The big difference between fancy indexing and a join method is of course that indexing can appear on the left side of an expression.
Sturla
- Previous message: [Python-ideas] 'where' statement in Python?
- Next message: [Python-ideas] 'where' statement in Python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]