-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
API DesignClosing CandidateMay be closeable, needs more eyeballsMay be closeable, needs more eyeballsEnhancementIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselves
Description
I've thrown in a few functions which I think are similar (but I've seen a few times asked about). e.g. this SO question.
User wants to get the index where a criteria is true:
import pandas as pd
myseries = pd.Series([1,4,0,7,5], index=[0,1,2,3,4])
print myseries.find(7) # should output 3
I guess the usual way is to use:
s[msk].index
s[msk].index[0]
Or as @jreback suggests (in this simple example):
pd.index(s).get_loc(7)
Perhaps there should be some methods to grab these out efficiently (i.e. short-circuit in cython)... maybe it makes more sense to have a crit function rather than a mask.
cc @cpcloud
also similar to idxmax and idxmin.
Metadata
Metadata
Assignees
Labels
API DesignClosing CandidateMay be closeable, needs more eyeballsMay be closeable, needs more eyeballsEnhancementIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselves