Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Learning indexing with python, pick dates
Hi all,
I have two data frames both contain time indexes with the same time period.
I want to pick start and end periods from the first data frame

Out[894]: Timestamp('2019-02-08 07:53:33.360000')
Out[895]: Timestamp('2019-02-08 07:54:00.149000')
and then I want to pick the numeric indexes from a second data frame where these time stamps fall in.

Can you think of an elegant way to do that?
Thanks a lot
I think, quite elegant would be a two stage approach, e.g.
cond = (df2.index > start) & (df2.index < end)
df2.reset_index()[cond].index     # or concat `.tolist()` statement,

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Pandas Indexing with duplicates energerecontractuel 3 512 Mar-07-2019, 12:57 AM
Last Post: scidam
  Pick a line in a plot with matplotlib Romain 2 1,005 Sep-18-2018, 01:41 PM
Last Post: Romain
  python array/cell/indexing python 1 931 Feb-08-2018, 11:18 AM
Last Post: DeaD_EyE
  Extract data between two dates from a .csv file using Python 2.7 sujai_banerji 1 5,076 Nov-15-2017, 09:48 PM
Last Post: snippsat
  How to pick random entries of stock prices? Alberto 1 1,303 Jul-16-2017, 09:51 PM
Last Post: wavic

Forum Jump:

Users browsing this thread: 1 Guest(s)