You can use apply and slicing the string
raw_data['nome_arquivo'] = raw_data['nome_arquivo'].apply(lambda x: x[:-4])
You can also use replace
raw_data['nome_arquivo'] = raw_data['nome_arquivo'].str.replace('.txt','')
Entree
ARQUIVOS
0 AAAAAAAAAAAFFFFFFFFFFFFFFFFBBBBBBBBBBBBB.txt
1 AAAAAAAAAAAFFFFFFFFFFFFFFFFBBBBBBBBBBBBB.txt
2 AAAAAAAAAAFFFBBBBBBBBBBBBB.txt
3 AAAAAAAAAAAFFFFFFFFFFFBBBBBBB.txt
4 AAAAAAAAAAAFFFFFFFFFFFFFFFFBBBBBBBBBBBBB.txt
5 AAAAAAAAAAAFFFFFFFFFFBBBBBBBBBBBBB.txt
6 AAAAAAAAAAAFFFFBBBBBBBBBBBBB.txt
7 AAFFFFFFFFFFFFFFFFBBBBBBBBBBBBB.txt
Exit
ARQUIVOS
0 AAAAAAAAAAAFFFFFFFFFFFFFFFFBBBBBBBBBBBBB
1 AAAAAAAAAAAFFFFFFFFFFFFFFFFBBBBBBBBBBBBB
2 AAAAAAAAAAFFFBBBBBBBBBBBBB
3 AAAAAAAAAAAFFFFFFFFFFFBBBBBBB
4 AAAAAAAAAAAFFFFFFFFFFFFFFFFBBBBBBBBBBBBB
5 AAAAAAAAAAAFFFFFFFFFFBBBBBBBBBBBBB
6 AAAAAAAAAAAFFFFBBBBBBBBBBBBB
7 AAFFFFFFFFFFFFFFFFBBBBBBBBBBBBB
Thanks, this command worked on the way out. However, when running the raw_data dataframe again, it displays all the other columns and this, but without the previous setting without the ". txt".
– Perciliano
@Perciliano has to do
raw_data['nome_arquivo'] = raw_data['nome_arquivo'].str.rstrip('.txt')
– Augusto Vasques