[英]check if syntax in pandas column meets certain criteria
I have the dataframe underneath:我在下面有 dataframe:
df = pd.DataFrame(np.array(['YM.296','MM.305','VO.081.019','VO.081.016','AM.081.002.001','AM081','SR.082','VO.081.012.001','VO.081.012.003']))
I want to know in what row the syntax is similar to 'XX.222.333' (example).我想知道语法在哪一行类似于“XX.222.333”(示例)。 So two letters followed by a stop ('.') followed by three numbers followed by a stop ('.') followed by three numbers again.
因此,两个字母后跟一个停止符('.'),然后是三个数字,然后是一个停止符('.'),然后是三个数字。
The desired outcome looks as follows:期望的结果如下所示:
tf = pd.DataFrame(np.array([False,False,True,True,False,False,False,False, False]))
Is there a fast and pythonic way to do this?有没有一种快速和pythonic的方法来做到这一点?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.