pandas: powerful Python data analysis toolkit - 0.25New in version 0.20.0. The replace method also accepts a compiled regular expression object from re.compile() as a pattern. All 466 Chapter 4. User Guide pandas: powerful Python data analysis toolkit, be included in the compiled regular expression object. In [37]: import re In [38]: regex_pat = re.compile(r'^.a|dog', flags=re.IGNORECASE) In [39]: s3.str.replace(regex_pat, 'XX-XX ') Out[39]: 0 A 10 码力 | 698 页 | 4.91 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.20.3object from re.compile() as a pattern. All flags should be included in the compiled regular expression object. New in version 0.20.0. In [35]: import re In [36]: regex_pat = re.compile(r'^.a|dog', flags=re replace(pat, repl) 0 tWO 1 bAR dtype: object Using a compiled regex with flags >>> regex_pat = re.compile(r'FUZ', flags=re.IGNORECASE) >>> pd.Series(['foo', 'fuz', np.nan]).str.replace(regex_pat, 'bar') Release 0.20.3 Returns is_regex : bool Whether obj is a regex pattern. Examples >>> is_re(re.compile(".*")) True >>> is_re("foo") False 34.16.4.41 pandas.api.types.is_re_compilable pandas.api.types0 码力 | 2045 页 | 9.18 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.20.2object from re.compile() as a pattern. All flags should be included in the compiled regular expression object. New in version 0.20.0. In [35]: import re In [36]: regex_pat = re.compile(r'^.a|dog', flags=re Python data analysis toolkit, Release 0.20.2 Using a compiled regex with flags >>> regex_pat = re.compile(r'FUZ', flags=re.IGNORECASE) >>> pd.Series(['foo', 'fuz', np.nan]).str.replace(regex_pat, 'bar') object to check. Returns is_regex : bool Whether obj is a regex pattern. Examples >>> is_re(re.compile(".*")) True >>> is_re("foo") False 34.16.4.41 pandas.api.types.is_re_compilable pandas.api.types0 码力 | 1907 页 | 7.83 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.21.1object from re.compile() as a pattern. All flags should be included in the compiled regular expression object. New in version 0.20.0. In [35]: import re In [36]: regex_pat = re.compile(r'^.a|dog', flags=re Python data analysis toolkit, Release 0.21.1 Using a compiled regex with flags >>> regex_pat = re.compile(r'FUZ', flags=re.IGNORECASE) >>> pd.Series(['foo', 'fuz', np.nan]).str.replace(regex_pat, 'bar') functions 2011 pandas: powerful Python data analysis toolkit, Release 0.21.1 Examples >>> is_re(re.compile(".*")) True >>> is_re("foo") False 34.19.4.41 pandas.api.types.is_re_compilable pandas.api.types0 码力 | 2207 页 | 8.59 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 1.4.2regular expression object from re.compile() as a pattern. All flags should be included in the compiled regular expression object. In [57]: import re In [58]: regex_pat = re.compile(r"^.a|dog", flags=re.IGNORECASE) regex=True) 0 tWO 1 bAR dtype: object Using a compiled regex with flags >>> import re >>> regex_pat = re.compile(r'FUZ', flags=re.IGNORECASE) >>> pd.Series(['foo', 'fuz', np.nan]).str.replace(regex_pat, 'bar' expand=True) 0 1 0 foojpgbar A compiled regex can be passed as pat >>> import re >>> s.str.split(re.compile(r"\.jpg"), expand=True) 0 1 0 foojpgbar When regex=False, pat is interpreted as the string itself0 码力 | 3739 页 | 15.24 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 1.4.4regular expression object from re.compile() as a pattern. All flags should be included in the compiled regular expression object. In [57]: import re In [58]: regex_pat = re.compile(r"^.a|dog", flags=re.IGNORECASE) regex=True) 0 tWO 1 bAR dtype: object Using a compiled regex with flags >>> import re >>> regex_pat = re.compile(r'FUZ', flags=re.IGNORECASE) >>> pd.Series(['foo', 'fuz', np.nan]).str.replace(regex_pat, 'bar' expand=True) 0 1 0 foojpgbar A compiled regex can be passed as pat >>> import re >>> s.str.split(re.compile(r"\.jpg"), expand=True) 0 1 0 foojpgbar When regex=False, pat is interpreted as the string itself0 码力 | 3743 页 | 15.26 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 1.0.0regular expression object from re.compile() as a pattern. All flags should be included in the compiled regular expression object. In [52]: import re In [53]: regex_pat = re.compile(r'^.a|dog', flags=re.IGNORECASE) repl) 0 tWO 1 bAR dtype: object Using a compiled regex with flags >>> import re >>> regex_pat = re.compile(r'FUZ', flags=re.IGNORECASE) >>> pd.Series(['foo', 'fuz', np.nan]).str.replace(regex_pat, 'bar') object to check] Returns is_regex [bool] Whether obj is a regex pattern. Examples >>> is_re(re.compile(".*")) True >>> is_re("foo") False pandas.api.types.is_re_compilable pandas.api.types.is_re_compilable(obj)0 码力 | 3015 页 | 10.78 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.25.0regular expression object from re.compile() as a pattern. All flags should be included in the compiled regular expression object. In [37]: import re In [38]: regex_pat = re.compile(r'^.a|dog', flags=re.IGNORECASE) repl) 0 tWO 1 bAR dtype: object Using a compiled regex with flags >>> import re >>> regex_pat = re.compile(r'FUZ', flags=re.IGNORECASE) >>> pd.Series(['foo', 'fuz', np.nan]).str.replace(regex_pat, 'bar') object to check] Returns is_regex [bool] Whether obj is a regex pattern. Examples >>> is_re(re.compile(".*")) True >>> is_re("foo") False 6.15. General utility functions 2143 pandas: powerful Python0 码力 | 2827 页 | 9.62 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 0.25.1regular expression object from re.compile() as a pattern. All flags should be included in the compiled regular expression object. In [37]: import re In [38]: regex_pat = re.compile(r'^.a|dog', flags=re.IGNORECASE) repl) 0 tWO 1 bAR dtype: object Using a compiled regex with flags >>> import re >>> regex_pat = re.compile(r'FUZ', flags=re.IGNORECASE) >>> pd.Series(['foo', 'fuz', np.nan]).str.replace(regex_pat, 'bar') object to check] Returns is_regex [bool] Whether obj is a regex pattern. Examples >>> is_re(re.compile(".*")) True >>> is_re("foo") False 6.15. General utility functions 2143 pandas: powerful Python0 码力 | 2833 页 | 9.65 MB | 1 年前3
pandas: powerful Python data analysis toolkit - 1.0regular expression object from re.compile() as a pattern. All flags should be included in the compiled regular expression object. In [52]: import re In [53]: regex_pat = re.compile(r'^.a|dog', flags=re.IGNORECASE) repl) 0 tWO 1 bAR dtype: object Using a compiled regex with flags >>> import re >>> regex_pat = re.compile(r'FUZ', flags=re.IGNORECASE) >>> pd.Series(['foo', 'fuz', np.nan]).str.replace(regex_pat, 'bar') object to check] Returns is_regex [bool] Whether obj is a regex pattern. Examples >>> is_re(re.compile(".*")) True >>> is_re("foo") False pandas.api.types.is_re_compilable pandas.api.types.is_re_compilable(obj)0 码力 | 3091 页 | 10.16 MB | 1 年前3
共 29 条
- 1
- 2
- 3













