Display values that does not end with ".0" Python Pandas
<p>I have a float column that contains <code>NaN</code> values and float values. How do i filter out those values that does not end with <code>.0</code>?</p>

<p>For example:</p>

<pre><code>Col1
0.7
1.0
1.1
9.0
9.5
NaN
</code></pre>

<p>Desire result will be:</p>

<pre><code>Col1
0.7
1.1 
9.2
</code></pre>

<p>You can use <a href="http://pandas.pydata.org/pandas-docs/stable/indexing.html#boolean-indexing" rel="nofollow"><code>boolean indexing</code></a>:</p>

<pre><code>#convert to string and compare last value
print ((df.Col1.astype(str).str[-1] != '0') &amp; (df.Col1.notnull()))
0     True
1    False
2     True
3    False
4     True
5    False
Name: Col1, dtype: bool

print (df[(df.Col1.astype(str).str[-1] != '0') &amp; (df.Col1.notnull())])
   Col1
0   0.7
2   1.1
4   9.5
</code></pre>

<p>Another solution for comparing converted value to <code>Ã¬nt</code>, but first need <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.fillna.html" rel="nofollow"><code>fillna</code></a>:</p>

<pre><code>s = df.Col1.fillna(1)
print (df[s.astype(int) != s])
   Col1
0   0.7
2   1.1
4   9.5
</code></pre>

<p><strong>Timings</strong>:</p>

<pre><code>#[30000 rows x 1 columns]
df = pd.concat([df]*10000).reset_index(drop=True)

def jez2(df):
    s = df.Col1.fillna(1)
    return (df[s.astype(int) != s])

In [179]: %timeit (df[(df.Col1.astype(str).str[-1] != '0') &amp; (df.Col1.notnull())])
10 loops, best of 3: 80.2 ms per loop

In [180]: %timeit (jez2(df))
1000 loops, best of 3: 1.16 ms per loop

In [181]: %timeit (df[df.Col1 // 1 != df.Col1].dropna())
100 loops, best of 3: 3.04 ms per loop

In [182]: %timeit (df[df['Col1'].mod(1) &gt; 0].dropna())
100 loops, best of 3: 2.58 ms per loop
</code></pre>

python pandas indexing condition