4
I hope you can help. I’m new to python and my question is this. I created a regex
extracted from a file in csv the parts of the text I want. But I want to save the output of this function in csv to compare with the starting table to know how mine regex
is good. Basically we take the output of my function and generate a table in csv. Can someone help me? Thank you!
Below is the code. What I would like to do is to save the pms list in csv along with some input table columns(df)
import re
import pandas as pd
df = pd.read_csv('C:/Users/b223902594/Documents/Sentenças/codigos/teste.csv', sep=';')
sentenca = df["descricao"] #descrição é uma das quatro colunas da tabela original.
def verificar_padroes_sentenca(lista_sentencas):
regex = r'(julgo .* dias-multa)|(julgo.*\babsolv)|(julgo .* punibilidade)| (julgo .* Lei)| (julgo .* dias multa)'
for sentenca in lista_sentencas:
pms = re.findall(regex, sentenca, flags=re.IGNORECASE)
print(pms)
Sorry I didn’t pass before! I’m new. Grateful!