<h3 dir="auto">Reproducing code example:</h3>

<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
&gt;&gt;&gt; time_type = data.index.dtype
&gt;&gt;&gt; time_type
datetime64[ns, tzfile('PRC')]

&gt;&gt;&gt; time_type == np.dtype('int32')
False
&gt;&gt;&gt; time_type in [1,2,3]
False
&gt;&gt;&gt; time_type in {np.dtype('int32')}
False
&gt;&gt;&gt; time_type in [np.dtype('int32')]
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
TypeError: Cannot interpret 'datetime64[ns, tzfile('PRC')]' as a data type"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">time_type</span> <span class="pl-c1">=</span> <span class="pl-s1">data</span>.<span class="pl-s1">index</span>.<span class="pl-s1">dtype</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">time_type</span>
<span class="pl-s1">datetime64</span>[<span class="pl-s1">ns</span>, <span class="pl-en">tzfile</span>(<span class="pl-s">'PRC'</span>)]

<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">time_type</span> <span class="pl-c1">==</span> <span class="pl-s1">np</span>.<span class="pl-en">dtype</span>(<span class="pl-s">'int32'</span>)
<span class="pl-c1">False</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">time_type</span> <span class="pl-c1">in</span> [<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>]
<span class="pl-c1">False</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">time_type</span> <span class="pl-c1">in</span> {<span class="pl-s1">np</span>.<span class="pl-en">dtype</span>(<span class="pl-s">'int32'</span>)}
<span class="pl-c1">False</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">time_type</span> <span class="pl-c1">in</span> [<span class="pl-s1">np</span>.<span class="pl-en">dtype</span>(<span class="pl-s">'int32'</span>)]
<span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"&lt;stdin&gt;"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
<span class="pl-v">TypeError</span>: <span class="pl-v">Cannot</span> <span class="pl-s1">interpret</span> <span class="pl-s">'datetime64[ns, tzfile('</span><span class="pl-v">PRC</span><span class="pl-s">')]'</span> <span class="pl-k">as</span> <span class="pl-s1">a</span> <span class="pl-s1">data</span> <span class="pl-s1">type</span></pre></div>
<h3 dir="auto">NumPy/Python version information:</h3>
<ul dir="auto">
<li>python3.9  pandas1.2.4  numpy 1.19.3（When I upgrade the numpy version, the problem is solved）</li>
</ul>
<blockquote>
<p dir="auto">I'd like to know why an exception is thrown when trying to use "in List[np.dtype]" judgment in this "special" version, while "in set[np.dtype]" or "==" does not cause this problem.</p>
</blockquote>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="dtype = pd.date_range(&quot;2016-01-01&quot;, periods=2, tz=&quot;UTC&quot;).dtype

&gt;&gt;&gt; dtype == np.dtype(&quot;datetime64[ns]&quot;)
False

&gt;&gt;&gt; np.dtype(&quot;datetime64[ns]&quot;) == dtype
TypeError: Cannot interpret 'datetime64[ns, UTC]' as a data type"><pre class="notranslate"><code class="notranslate">dtype = pd.date_range("2016-01-01", periods=2, tz="UTC").dtype

&gt;&gt;&gt; dtype == np.dtype("datetime64[ns]")
False

&gt;&gt;&gt; np.dtype("datetime64[ns]") == dtype
TypeError: Cannot interpret 'datetime64[ns, UTC]' as a data type
</code></pre></div>
<p dir="auto">It'd be nice if this returned False instead of raising.</p>