0

I have file where I want to delete the particular row when a particular thing(string) matches.
String matching I am doing through pandas.
I attached image how the input looks like and how I wanted my final output.
My main aim of the python code is to remove/delete any row where the Equipment onsite is null/nothing, otherwise if there is anything after equipment onsite, I wanted to keep it.

Image

File attached here

import pandas as pd 
import re
    
data = pd.read_csv("TestEquipmentOnsite.csv", header=0) 
    
pattern = r'[a-zA-Z0-9]+'
if re.search(pattern, data['Header']):
   data = data.drop("Header", axis=1)       
else:       
   print(data)

Any help where I am making the mistake???? Code is saying type error.

tlentali
  • 3,250
  • 2
  • 11
  • 20

0 Answers0