span class="n">loc</span><span class="p">[</span><span class="n">substring</span><span class="p">,</span> <span class="s2">&quot;times_nested&quot;</span><span class="p">]</span> <span class="o">+=</span> <span class="mi">1</span>
                    <span class="n">df</span><span class="o">.</span><span class="n">loc</span><span class="p">[</span><span class="n">substring</span><span class="p">,</span> <span class="s2">&quot;number_of_nested&quot;</span><span class="p">]</span> <span class="o">+=</span> <s