Python: UserWarning: This pattern has match groups. To actually get the groups, use str.extract
I have a dataframe and I try to get string, where on of column contain some string
Df looks like
member_id,event_path,event_time,event_duration
30595,"2016-03-30 12:27:33",yandex.ru/,1
30595,"2016-03-30 12:31:42",yandex.ru/,0
30595,"2016-03-30 12:31:43",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:44",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:45",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:46",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:49",kinogo.co/,1
30595,"2016-03-30 12:32:11",kinogo.co/melodramy/,0
And another df with urls
url
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnyj_telefon_bq_phoenix
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnyj_telefon_fly_
003.ru/sonyxperia
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnye_telefony_smartfony
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnye_telefony_smartfony/brands5D5Bbr_23
1click.ru/sonyxperia
1click.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/chasy-motorola
I use
urls = pd.read_csv('relevant_url1.csv', error_bad_lines=False)
substr = urls.url.values.tolist()
data = pd.read_csv('data_nts2.csv', error_bad_lines=False, chunksize=50000)
result = pd.DataFrame()
for i, df in enumerate(data):
res = df[df['event_time'].str.contains('|'.join(substr), regex=True)]
but it return me
UserWarning: This pattern has match groups. To actually get the groups, use str.extract.
How can I fix that?
python regex pandas
add a comment |
I have a dataframe and I try to get string, where on of column contain some string
Df looks like
member_id,event_path,event_time,event_duration
30595,"2016-03-30 12:27:33",yandex.ru/,1
30595,"2016-03-30 12:31:42",yandex.ru/,0
30595,"2016-03-30 12:31:43",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:44",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:45",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:46",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:49",kinogo.co/,1
30595,"2016-03-30 12:32:11",kinogo.co/melodramy/,0
And another df with urls
url
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnyj_telefon_bq_phoenix
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnyj_telefon_fly_
003.ru/sonyxperia
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnye_telefony_smartfony
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnye_telefony_smartfony/brands5D5Bbr_23
1click.ru/sonyxperia
1click.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/chasy-motorola
I use
urls = pd.read_csv('relevant_url1.csv', error_bad_lines=False)
substr = urls.url.values.tolist()
data = pd.read_csv('data_nts2.csv', error_bad_lines=False, chunksize=50000)
result = pd.DataFrame()
for i, df in enumerate(data):
res = df[df['event_time'].str.contains('|'.join(substr), regex=True)]
but it return me
UserWarning: This pattern has match groups. To actually get the groups, use str.extract.
How can I fix that?
python regex pandas
add a comment |
I have a dataframe and I try to get string, where on of column contain some string
Df looks like
member_id,event_path,event_time,event_duration
30595,"2016-03-30 12:27:33",yandex.ru/,1
30595,"2016-03-30 12:31:42",yandex.ru/,0
30595,"2016-03-30 12:31:43",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:44",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:45",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:46",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:49",kinogo.co/,1
30595,"2016-03-30 12:32:11",kinogo.co/melodramy/,0
And another df with urls
url
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnyj_telefon_bq_phoenix
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnyj_telefon_fly_
003.ru/sonyxperia
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnye_telefony_smartfony
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnye_telefony_smartfony/brands5D5Bbr_23
1click.ru/sonyxperia
1click.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/chasy-motorola
I use
urls = pd.read_csv('relevant_url1.csv', error_bad_lines=False)
substr = urls.url.values.tolist()
data = pd.read_csv('data_nts2.csv', error_bad_lines=False, chunksize=50000)
result = pd.DataFrame()
for i, df in enumerate(data):
res = df[df['event_time'].str.contains('|'.join(substr), regex=True)]
but it return me
UserWarning: This pattern has match groups. To actually get the groups, use str.extract.
How can I fix that?
python regex pandas
I have a dataframe and I try to get string, where on of column contain some string
Df looks like
member_id,event_path,event_time,event_duration
30595,"2016-03-30 12:27:33",yandex.ru/,1
30595,"2016-03-30 12:31:42",yandex.ru/,0
30595,"2016-03-30 12:31:43",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:44",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:45",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:46",yandex.ru/search/?lr=10738&msid=22901.25826.1459330364.89548&text=%D1%84%D0%B8%D0%BB%D1%8C%D0%BC%D1%8B+%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD&suggest_reqid=168542624144922467267026838391360&csg=3381%2C3938%2C2%2C3%2C1%2C0%2C0,0
30595,"2016-03-30 12:31:49",kinogo.co/,1
30595,"2016-03-30 12:32:11",kinogo.co/melodramy/,0
And another df with urls
url
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnyj_telefon_bq_phoenix
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnyj_telefon_fly_
003.ru/sonyxperia
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnye_telefony_smartfony
003.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/mobilnye_telefony_smartfony/brands5D5Bbr_23
1click.ru/sonyxperia
1click.ru/[a-zA-Z0-9-_%$#?.:+=|()]+/chasy-motorola
I use
urls = pd.read_csv('relevant_url1.csv', error_bad_lines=False)
substr = urls.url.values.tolist()
data = pd.read_csv('data_nts2.csv', error_bad_lines=False, chunksize=50000)
result = pd.DataFrame()
for i, df in enumerate(data):
res = df[df['event_time'].str.contains('|'.join(substr), regex=True)]
but it return me
UserWarning: This pattern has match groups. To actually get the groups, use str.extract.
How can I fix that?
python regex pandas
python regex pandas
asked Oct 6 '16 at 16:47
Petr Petrov
85911227
85911227
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
At least one of the regex patterns in urls must use a capturing group.
str.contains only returns True or False for each row in df['event_time'] --
it does not make use of the capturing group. Thus, the UserWarning is alerting you
that the regex uses a capturing group but the match is not used.
If you wish to remove the UserWarning you could find and remove the capturing group from the regex pattern(s). They are not shown in the regex patterns you posted, but they must be there in your actual file. Look for parentheses outside of the character classes.
Alternatively, you could suppress this particular UserWarning by putting
import warnings
warnings.filterwarnings("ignore", 'This pattern has match groups')
before the call to str.contains.
Here is a simple example which demonstrates the problem (and solution):
# import warnings
# warnings.filterwarnings("ignore", 'This pattern has match groups') # uncomment to suppress the UserWarning
import pandas as pd
df = pd.DataFrame({ 'event_time': ['gouda', 'stilton', 'gruyere']})
urls = pd.DataFrame({'url': ['g(.*)']}) # With a capturing group, there is a UserWarning
# urls = pd.DataFrame({'url': ['g.*']}) # Without a capturing group, there is no UserWarning. Uncommenting this line avoids the UserWarning.
substr = urls.url.values.tolist()
df[df['event_time'].str.contains('|'.join(substr), regex=True)]
prints
script.py:10: UserWarning: This pattern has match groups. To actually get the groups, use str.extract.
df[df['event_time'].str.contains('|'.join(substr), regex=True)]
Removing the capturing group from the regex pattern:
urls = pd.DataFrame({'url': ['g.*']})
avoids the UserWarning.
add a comment |
Since regex=True is provided, sublist gets treated as a regex, which in your case contains capturing groups (strings enclosed with parentheses).
You get the warning because if you want to capture something then there is no use of str.contains (which returns boolean depending upon whether the provided pattern is contained within the string or not)
Obviously, you can suppress the warnings but it's better to fix
them.
Either escape the parenthesis blocks or use str.extract if you really want to capture something.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f39901550%2fpython-userwarning-this-pattern-has-match-groups-to-actually-get-the-groups%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
At least one of the regex patterns in urls must use a capturing group.
str.contains only returns True or False for each row in df['event_time'] --
it does not make use of the capturing group. Thus, the UserWarning is alerting you
that the regex uses a capturing group but the match is not used.
If you wish to remove the UserWarning you could find and remove the capturing group from the regex pattern(s). They are not shown in the regex patterns you posted, but they must be there in your actual file. Look for parentheses outside of the character classes.
Alternatively, you could suppress this particular UserWarning by putting
import warnings
warnings.filterwarnings("ignore", 'This pattern has match groups')
before the call to str.contains.
Here is a simple example which demonstrates the problem (and solution):
# import warnings
# warnings.filterwarnings("ignore", 'This pattern has match groups') # uncomment to suppress the UserWarning
import pandas as pd
df = pd.DataFrame({ 'event_time': ['gouda', 'stilton', 'gruyere']})
urls = pd.DataFrame({'url': ['g(.*)']}) # With a capturing group, there is a UserWarning
# urls = pd.DataFrame({'url': ['g.*']}) # Without a capturing group, there is no UserWarning. Uncommenting this line avoids the UserWarning.
substr = urls.url.values.tolist()
df[df['event_time'].str.contains('|'.join(substr), regex=True)]
prints
script.py:10: UserWarning: This pattern has match groups. To actually get the groups, use str.extract.
df[df['event_time'].str.contains('|'.join(substr), regex=True)]
Removing the capturing group from the regex pattern:
urls = pd.DataFrame({'url': ['g.*']})
avoids the UserWarning.
add a comment |
At least one of the regex patterns in urls must use a capturing group.
str.contains only returns True or False for each row in df['event_time'] --
it does not make use of the capturing group. Thus, the UserWarning is alerting you
that the regex uses a capturing group but the match is not used.
If you wish to remove the UserWarning you could find and remove the capturing group from the regex pattern(s). They are not shown in the regex patterns you posted, but they must be there in your actual file. Look for parentheses outside of the character classes.
Alternatively, you could suppress this particular UserWarning by putting
import warnings
warnings.filterwarnings("ignore", 'This pattern has match groups')
before the call to str.contains.
Here is a simple example which demonstrates the problem (and solution):
# import warnings
# warnings.filterwarnings("ignore", 'This pattern has match groups') # uncomment to suppress the UserWarning
import pandas as pd
df = pd.DataFrame({ 'event_time': ['gouda', 'stilton', 'gruyere']})
urls = pd.DataFrame({'url': ['g(.*)']}) # With a capturing group, there is a UserWarning
# urls = pd.DataFrame({'url': ['g.*']}) # Without a capturing group, there is no UserWarning. Uncommenting this line avoids the UserWarning.
substr = urls.url.values.tolist()
df[df['event_time'].str.contains('|'.join(substr), regex=True)]
prints
script.py:10: UserWarning: This pattern has match groups. To actually get the groups, use str.extract.
df[df['event_time'].str.contains('|'.join(substr), regex=True)]
Removing the capturing group from the regex pattern:
urls = pd.DataFrame({'url': ['g.*']})
avoids the UserWarning.
add a comment |
At least one of the regex patterns in urls must use a capturing group.
str.contains only returns True or False for each row in df['event_time'] --
it does not make use of the capturing group. Thus, the UserWarning is alerting you
that the regex uses a capturing group but the match is not used.
If you wish to remove the UserWarning you could find and remove the capturing group from the regex pattern(s). They are not shown in the regex patterns you posted, but they must be there in your actual file. Look for parentheses outside of the character classes.
Alternatively, you could suppress this particular UserWarning by putting
import warnings
warnings.filterwarnings("ignore", 'This pattern has match groups')
before the call to str.contains.
Here is a simple example which demonstrates the problem (and solution):
# import warnings
# warnings.filterwarnings("ignore", 'This pattern has match groups') # uncomment to suppress the UserWarning
import pandas as pd
df = pd.DataFrame({ 'event_time': ['gouda', 'stilton', 'gruyere']})
urls = pd.DataFrame({'url': ['g(.*)']}) # With a capturing group, there is a UserWarning
# urls = pd.DataFrame({'url': ['g.*']}) # Without a capturing group, there is no UserWarning. Uncommenting this line avoids the UserWarning.
substr = urls.url.values.tolist()
df[df['event_time'].str.contains('|'.join(substr), regex=True)]
prints
script.py:10: UserWarning: This pattern has match groups. To actually get the groups, use str.extract.
df[df['event_time'].str.contains('|'.join(substr), regex=True)]
Removing the capturing group from the regex pattern:
urls = pd.DataFrame({'url': ['g.*']})
avoids the UserWarning.
At least one of the regex patterns in urls must use a capturing group.
str.contains only returns True or False for each row in df['event_time'] --
it does not make use of the capturing group. Thus, the UserWarning is alerting you
that the regex uses a capturing group but the match is not used.
If you wish to remove the UserWarning you could find and remove the capturing group from the regex pattern(s). They are not shown in the regex patterns you posted, but they must be there in your actual file. Look for parentheses outside of the character classes.
Alternatively, you could suppress this particular UserWarning by putting
import warnings
warnings.filterwarnings("ignore", 'This pattern has match groups')
before the call to str.contains.
Here is a simple example which demonstrates the problem (and solution):
# import warnings
# warnings.filterwarnings("ignore", 'This pattern has match groups') # uncomment to suppress the UserWarning
import pandas as pd
df = pd.DataFrame({ 'event_time': ['gouda', 'stilton', 'gruyere']})
urls = pd.DataFrame({'url': ['g(.*)']}) # With a capturing group, there is a UserWarning
# urls = pd.DataFrame({'url': ['g.*']}) # Without a capturing group, there is no UserWarning. Uncommenting this line avoids the UserWarning.
substr = urls.url.values.tolist()
df[df['event_time'].str.contains('|'.join(substr), regex=True)]
prints
script.py:10: UserWarning: This pattern has match groups. To actually get the groups, use str.extract.
df[df['event_time'].str.contains('|'.join(substr), regex=True)]
Removing the capturing group from the regex pattern:
urls = pd.DataFrame({'url': ['g.*']})
avoids the UserWarning.
edited Oct 6 '16 at 17:37
answered Oct 6 '16 at 17:30
unutbu
541k10011551223
541k10011551223
add a comment |
add a comment |
Since regex=True is provided, sublist gets treated as a regex, which in your case contains capturing groups (strings enclosed with parentheses).
You get the warning because if you want to capture something then there is no use of str.contains (which returns boolean depending upon whether the provided pattern is contained within the string or not)
Obviously, you can suppress the warnings but it's better to fix
them.
Either escape the parenthesis blocks or use str.extract if you really want to capture something.
add a comment |
Since regex=True is provided, sublist gets treated as a regex, which in your case contains capturing groups (strings enclosed with parentheses).
You get the warning because if you want to capture something then there is no use of str.contains (which returns boolean depending upon whether the provided pattern is contained within the string or not)
Obviously, you can suppress the warnings but it's better to fix
them.
Either escape the parenthesis blocks or use str.extract if you really want to capture something.
add a comment |
Since regex=True is provided, sublist gets treated as a regex, which in your case contains capturing groups (strings enclosed with parentheses).
You get the warning because if you want to capture something then there is no use of str.contains (which returns boolean depending upon whether the provided pattern is contained within the string or not)
Obviously, you can suppress the warnings but it's better to fix
them.
Either escape the parenthesis blocks or use str.extract if you really want to capture something.
Since regex=True is provided, sublist gets treated as a regex, which in your case contains capturing groups (strings enclosed with parentheses).
You get the warning because if you want to capture something then there is no use of str.contains (which returns boolean depending upon whether the provided pattern is contained within the string or not)
Obviously, you can suppress the warnings but it's better to fix
them.
Either escape the parenthesis blocks or use str.extract if you really want to capture something.
answered Aug 27 at 8:55
Chankey Pathak
14.8k951103
14.8k951103
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f39901550%2fpython-userwarning-this-pattern-has-match-groups-to-actually-get-the-groups%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown