how can I test for ordered subset
<p><strong><em>firstly</em></strong><br>
I need to be able to test that <code>'abc'</code> is an ordered subset of <code>'axbyc'</code> and <code>'egd'</code> is not an ordered subset of <code>'edg'</code>.  Another way to say it is that it is an ordered subset if I can remove specific characters of of one string and have it be equal to another.</p>

<p><strong><em>secondly</em></strong><br>
I need to compare one <code>pd.Series</code> with another <code>pd.Series</code> to determine if the elements of one are ordered subsets of the corresponding element of the other.</p>

<p>consider the <code>pd.Series</code> <code>s1</code> and <code>s2</code></p>

<pre><code>s1 = pd.Series(['abc', 'egd'])
s2 = pd.Series(['axbyc', 'edg'])
</code></pre>

<p>I need to compare them such that the results of the question<br>
Are the elements of <code>s1</code> ordered subsets of <code>s2</code> equals</p>

<pre><code>0     True
1    False
dtype: bool
</code></pre>

<p>For the first part of the question:</p>

<pre><code>def ordered_subset(s1, s2):
    s2 = iter(s2)
    try:
        for c in s1:
            while next(s2) != c:
                pass
        else:
            return True
    except StopIteration:
        return False
</code></pre>

<p>For the second part of the question:</p>

<pre><code>pd.concat([s1, s2], axis=1).apply(lambda x: ordered_subset(*x), axis=1)

0     True
1    False
dtype: bool
</code></pre>

python pandas