Sep-28-2021, 03:29 AM
I have file where I want to replace the particular row when a particular thing(string) matches with semicolon. If Equipment onsite is null/nothing then replace with semicolon, otherwise if there is anything after equipment onsite, I wanted to keep as it is. Check the image how the output look likes. any help what wrong in regular expression.
import pandas as pd import re data = pd.read_csv("TestEquipmentOnsite.csv", header=0) data = data.replace(r",Equipment onsite=", ";", regex=True) print(data)
Attached Files