[Python] Replace Any Word Containing a Specified Character Python

Discussão em 'Python' iniciado por Stack, Maio 26, 2025.

  1. Stack

    Stack Membro Participativo

    I have a pandas data frame column containing strings. I want to get rid of any "word" containing a "@" regardless of its position. I have gotten this far:

    Df1['Col1'] = Df1['Col1'].str.replace(r', '')


    I have searched extensively but can't figure out how to write the regex to match "words" such as '@hey' or 'm@y'.

    Thank you!

    Continue reading...

Compartilhe esta Página