Wolfram Language & System 10.3 (2015)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

PositionIndex

PositionIndex[list]
gives an association between unique elements in list and the positions at which they occur.

PositionIndex[assoc]
gives an association whose keys are the distinct values in assoc, and whose values are lists of the keys with which they are associated.

DetailsDetails

  • In PositionIndex[expr], the keys in the result appear in the order of their first occurrence in expr.

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Find positions of list elements:

In[1]:=
Click for copyable input
Out[1]=

Find positions of elements in an association:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2014
(10.0)