Is there a query method or similar for pandas Series (pandas.Series.query())?
<p>The <code>pandas.DataFrame.query()</code> method is of great usage for (pre/post)-filtering data when loading or plotting. It comes particularly handy for method chaining.</p>
<p>I find myself often wanting to apply the same logic to a <code>pandas.Series</code>, e.g. after having done a  method such as <code>df.value_counts</code> which returns a <code>pandas.Series</code>.</p>
<h1>Example</h1>
<p>Lets assume there is a huge table with the columns <code>Player, Game, Points</code> and I want to plot a histogram of the players with more than 14 times 3 points. I first have to sum the points of each player (<code>groupby -&gt; agg</code>) which will return a Series of ~1000 players and their overall points. Applying the <code>.query</code> logic it would look something like this:</p>
<pre><code>df = pd.DataFrame({
    'Points': [random.choice([1,3]) for x in range(100)], 
    'Player': [random.choice([&quot;A&quot;,&quot;B&quot;,&quot;C&quot;]) for x in range(100)]})

(df
     .query(&quot;Points == 3&quot;)
     .Player.values_count()
     .query(&quot;&gt; 14&quot;)
     .hist())
</code></pre>
<p>The only solutions I find force me to do an unnecessary assignment and break the method chaining:</p>
<pre><code>(points_series = df
     .query(&quot;Points == 3&quot;)
     .groupby(&quot;Player&quot;).size()
points_series[points_series &gt; 100].hist()
</code></pre>
<p>Method chaining as well as the query method help to keep the code legible meanwhile the subsetting-filtering can get messy quite quickly.</p>
<pre><code># just to make my point :)
series_bestplayers_under_100[series_prefiltered_under_100 &gt; 0].shape
</code></pre>
<p>Please help me out of my dilemma! Thanks</p>