“Usuń interpunkcję w kolumnie DataFrame” Kod odpowiedzi

Seria Pandy usuń interpunkcję

# Define the function to remove the punctuation
def remove_punctuations(text):
    for punctuation in string.punctuation:
        text = text.replace(punctuation, '')
    return text
# Apply to the DF series
df['new_column'] = df['column'].apply(remove_punctuations)
Depressed Dotterel

Python Pandas usuwają interpunkcję

x = pd.DataFrame(dict(column1=["Lorum. ipsum.?"]))
x["column1"] = x["column1"].str.replace('[^\w\s]','')
Sulphix

Usuń interpunkcję w kolumnie DataFrame

new column and column
Shiny Scarab

Odpowiedzi podobne do “Usuń interpunkcję w kolumnie DataFrame”

Pytania podobne do “Usuń interpunkcję w kolumnie DataFrame”

Więcej pokrewnych odpowiedzi na “Usuń interpunkcję w kolumnie DataFrame” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu