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>use <code>'.*'.join</code> to create a regex pattern to match against sequence.</p>

<pre><code>import re
import pandas as pd

s1 = pd.Series(['abc', 'egd'])
s2 = pd.Series(['axbyc', 'edg'])

match = lambda x: bool(re.match(*x))
pd.concat([s1.str.join('.*'), s2], axis=1).T.apply(match)

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

<hr>

<p>Notice that</p>

<pre><code>s1.str.join('.*')

0    a.*b.*c
1    e.*g.*d
Name: x, dtype: object
</code></pre>

python pandas