擅长:python、mysql、java
<p>考虑到列表中的日期最多包含每日信息,您可以从将<a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.dt.floor.html" rel="nofollow noreferrer">^{<cd1>}</a>)添加到<code>DatetimeIndex</code>到每日级别,并使用<a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.isin.html" rel="nofollow noreferrer">^{<cd3>}</a>为日期时间对象列表编制索引:</p>
<pre><code>t = [pd.to_datetime('2017-07-10'), pd.to_datetime('2017-09-10')]
df.index= pd.to_datetime(df.index)
df[df.index.floor('d').isin(t)]
</code></pre>
<p><b>输出</b></p>
^{pr2}$