This may be really trivial but I'm struggling to get anywhere with it.
So basically I have a column of ID's where some values are alphanumeric and some contain text prefixed before the alphanumeric value. How do I loop through that specific column and check whether the alphanumeric value has been prefixed with a string and then remove that string accordingly.
This is the way I was doing it but it's not working, nor is it the smart way to do it:
document[ID] = document[ID].replace("ReferenceNode, Objectid:", '')
Example:
ID
5d61527f0928c99f3cf10829
5d61527f0928c99f3cf10829
ReferenceNode, ObjectID: 5d61527f0928c99f3cf10829
Expected Output:
ID
5d61527f0928c99f3cf10829
5d61527f0928c99f3cf10829
5d61527f0928c99f3cf10829
question from:
https://stackoverflow.com/questions/65935190/loop-over-a-column-and-remove-characters-python-pandas 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…