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.

1 Answer 1

1
to_remove = ['abc\(\d+\)', 'bca']
eda[~eda.devices.str.contains('|'.join(to_remove), regex=True)]
Sign up to request clarification or add additional context in comments.

3 Comments

I can remove single value using this. i have like abc(1),abc(2) tilll abc(70) and something like withe bca as well.
Use regex in the list, something like the updated answer @anmol
It would be specific in your case and I can't tell you directly. If you need regex assistance the check this link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.