python .loc with some condition(string, regex etc)
<p>I am willing to get subset of the dataframe. And the condition is that, the value of certain column starts with the string 'HOUS'. How should I do?. </p>

<pre><code>df.loc[df.id.startswith('HOUS')]
</code></pre>

<p>I should have searched more.</p>

<p>Here is the solution.</p>

<pre><code>df[df.id.str.startswith('HOUS')]
</code></pre>

python pandas dataframe substring