0

I have column which contains 4000 unique values(rows). I want to delete values such as 'I__ND_LD(1),I__ND_LD(2),P__ND_LN(1),I__XF_XF(4)'.these values are unique in numbers in the brackets. for example. 'I__ND_LD(1) starts with 1 and end with 'I__ND_LD(70).

By this code,I can remove only one character using above function. I want to remove all the values as mentioned in the problem.

eda[~eda.Devices.str.Contains("^I__ND_LD(1)")]

Is there any other technique through which i can remove all these values, also we have different number of 'I__ND_LD' and 'P__ND_LN(1). I want to implement this in the function so that I can just pass the values and it delete all the values in the column.

anmol
  • 85
  • 1
  • 8

1 Answers1

1
to_remove = ['abc\(\d+\)', 'bca']
eda[~eda.devices.str.contains('|'.join(to_remove), regex=True)]
Vishnudev Krishnadas
  • 10,679
  • 2
  • 23
  • 55