<p>首先,您需要将日期转换为适当的<code>datetime</code>对象,提供适当的输入格式(我假设是<code><weekday> <month>/<day></code>—您可以根据<code>datetime</code>文档<a href="https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior" rel="nofollow noreferrer">https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior</a>对其进行调整)。您可以通过以下方式进行:</p>
<pre class="lang-py prettyprint-override"><code>df["Date_2"]=pd.to_datetime(df["Date"].astype(str), format="%a %m/%d")
</code></pre>
<p>然后使用python<code>datetime.strptime()</code>方法对过滤条件进行类比转换:</p>
<pre class="lang-py prettyprint-override"><code>from datetime import datetime
df.loc[df["Date_2"]>datetime.strptime("Thu 11/12", "%a %m/%d")]
</code></pre>
<p>所以整个例子:</p>
<pre class="lang-py prettyprint-override"><code>import pandas as pd
from datetime import datetime
df=pd.DataFrame({"Date": ["Sat 11/16", "Fri 11/8", "Wed 11/13"], "x": [4,3,7]})
df["Date_2"]=pd.to_datetime(df["Date"].astype(str), format="%a %m/%d")
print("\nExample filtered: ")
print(df.loc[df["Date_2"]>datetime.strptime("Thu 11/12", "%a %m/%d")])
print("\nThe whole thing:")
print(df)
</code></pre>
<p>和输出:</p>
<pre class="lang-py prettyprint-override"><code>Example filtered:
Date x Date_2
0 Sat 11/16 4 1900-11-16
2 Wed 11/13 7 1900-11-13
The whole thing:
Date x Date_2
0 Sat 11/16 4 1900-11-16
1 Fri 11/8 3 1900-11-08
2 Wed 11/13 7 1900-11-13
</code></pre>
<p>(由于没有提供年份,因此假定为<code>1900</code>)</p>