-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Open
Labels
EnhancementStringsString extension data type and string dataString extension data type and string datareplacereplace methodreplace method
Description
Code Sample
# For ignoring case, I have to explicitly change the regex
replace_map = {
'[Q|q]uick[P|p]ay with [Z|z]elle payment to ': 'Payment to',
'[Q|q]uick[P|p]ay with [Z|z]elle payment from ': 'Payment from'
}
df.replace({'title': replace_map}, regex=True, inplace=True)Problem description
According to pandas docs for DataFrame.replace the replace has ability to take regex input, but doesn't have the ability to take in regex flags such as re.I or re.IGNORECASE for case insensitive search. Can we have a flags argument to take in regex module flags as input.
Expected Output
replace_map = {
'QuickPay with Zelle payment to ': 'Payment to',
'QuickPay with Zelle payment from ': 'Payment from'
}
# Can't we include flags as argument?
df.replace({'title': replace_map}, regex=True, inplace=True, flags=re.I) Metadata
Metadata
Assignees
Labels
EnhancementStringsString extension data type and string dataString extension data type and string datareplacereplace methodreplace method