'Find a certain date inside Timestamp vector

I have a certain timestamp vector and I need to find the position index of the date inside this vector. Let's say I want to find inside this vector the position index of 2017-01-01.

Here below is the basic code that creates a ts vector:

import numpy as np
import pandas as pd
ts_vec = []
t = pd._libs.tslibs.timestamps.Timestamp('2016-03-03 00:00:00')
for i in range(1000):
    ts_vec = [*ts_vec,t]
    t = t+pd.Timedelta(days=1)

ts_vec = np.array(ts_vec)

How should I do this? Thank You



Solution 1:[1]

outp = np.where(ts_vec==pd._libs.tslibs.timestamps.Timestamp('2017-01-01 00:00:00'))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gaetano Veti