I would like to remove a part of a string from a value inside a dataframe, using pandas.
Value:
"transaction DATUM 07.03.2019, 07.48 UHR1.TAN 246915 DATUM 14.10.2019, 09.03 UHR1.TAN 620955 Client Name"
What I want is to remove "DATUM 07.03.2019, 07.48 UHR1.TAN 246915 DATUM 14.10.2019, 09.03 UHR1.TAN 620955"
Expected result would be
"transaction Client Name"
You can use replace function like this.
df["transaction"] = df["transaction"].str.replace(r"(?<=transaction\s).*(?=\sClient)", "")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.