User Tools

Site Tools


str.extract_-_extract_string_betwen_two_strings_in_pandas

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
str.extract_-_extract_string_betwen_two_strings_in_pandas [2016/12/14 12:37]
vincenzo
str.extract_-_extract_string_betwen_two_strings_in_pandas [2016/12/14 12:40]
vincenzo
Line 17: Line 17:
  
 You need to match and capture the characters (The extract method accepts a regular expression with at least one capture group.) after http:// other than /, 1 or more times. It can be done with: You need to match and capture the characters (The extract method accepts a regular expression with at least one capture group.) after http:// other than /, 1 or more times. It can be done with:
- 
  
 <​code>​df.col.str.extract(r'​http://​([^/​]+)/​landing'​)</​code>​ <​code>​df.col.str.extract(r'​http://​([^/​]+)/​landing'​)</​code>​
- 
- 
  
 Your regex matches http:/, then 0+ / symbols as few as possible and then /landing. Your regex matches http:/, then 0+ / symbols as few as possible and then /landing.
str.extract_-_extract_string_betwen_two_strings_in_pandas.txt ยท Last modified: 2016/12/14 22:29 by vincenzo