I have a large pandas series containing approximately half a million rows of this form:
pd.Series(['Lorem ipsum dolor sit amet',
'consectetur adipiscing elit',
'quis euismod mi, id venenatis urna',
'curabitur vel augue viverra diam imperdiet laoreet'])
and I would like to filter the series by words that start and end with a specific letter. For example, if start letter is 'l' and end letter is 'm', then I want to include rows that have 'lorem' as substrings, or rather '^l.*m$'.
So I need to split my string into substring and do .str.contains('^l.*m$'), however I don't know of an optimised way to do this.