擅长:python、mysql、java
<p>对不起,我误解了这个问题</p>
<p><strong>更新的答案:</strong>您可以通过以下方式找到要删除的日期:</p>
<pre><code>df['_date'] = df.index.dt.date
incorrect_df = df[df['C/IC'] == 'incorrect']
incorrect_count = incorrect_df['C/IC'].groupby(by='_date').count()
dates_to_remove = set(incorrect_count[incorrect_count > 2]['_date'])
# using set to make the later step more efficient if the df is long
</code></pre>
<p>然后相应地屏蔽数据帧:</p>
<pre><code>mask = [x not in dates_to_remove for x in df['_date']
res = df[mask]
</code></pre>