pandas show column with regular expression

Solutions on MaxInterview for pandas show column with regular expression by the best coders in the world

showing results for - "pandas show column with regular expression"
Ricardo
27 Feb 2019
1S=pd.Series(['Finland','Colombia','Florida','Japan','Puerto Rico','Russia','france'])
2S.str.contains('^F.*')
3
Meryl
16 Jul 2016
1import numpy as np
2df['first_five_Letter']=df['Country (region)'].str.extract(r'(^\w{5})')
3df.head()
4
Elif
12 Oct 2016
1# Total items starting with F
2S.str.count(r'(^F.*)').sum()
3
Gautier
22 Jan 2016
1S=pd.Series(['Finland','Colombia','Florida','Japan','Puerto Rico','Russia','france'])
2[itm[0] for itm in S.str.findall('^[Ff].*') if len(itm)>0]
3
David
23 Jun 2018
1df[df['Country (region)'].str.count('^[pP].*')>0]
2
Roberto
02 Apr 2016
1# Get countries starting with letter P
2S=pd.Series(['Finland','Colombia','Florida','Japan','Puerto Rico','Russia','france'])
3S[S.str.match(r'(^P.*)')==True]
4
similar questions
queries leading to this page
pandas show column with regular expression