Last active
November 1, 2022 00:41
-
-
Save arthurpbarros/bc35a644ed0238266f2cdca27f8d8143 to your computer and use it in GitHub Desktop.
Usa a biblioteca pandas para manipular, filtrar a coluna "DOI" de vários arquivos de bases de dados em CSV e gravá-la em um novo arquivo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas | |
doi_ids = [] | |
for i in range(1,10): | |
nome_arquivo = f'PsycNET_Export({i}).csv' | |
print("File readed: %s" % nome_arquivo) | |
df = pandas.read_csv(nome_arquivo) | |
for index,row in df.iterrows(): | |
doi_ids.append(row['DOI']) | |
output_file = open("outputDOIs.txt","w") | |
for doi in doi_ids: | |
new = doi.replace('https://doi.org/','') | |
output_file.write(new+"\n") | |
output_file.close() | |
print("File with all DOIs created!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment