dtype error on file merge

Asked

Viewed 19 times

0

I need to join several csv files, where the columns are float. I made a small code, but the output of the columns are in str, so I tried to add the output format of the data, but the following error is coming out:

TypeError: 'dtype' is an invalid keyword argument for this function

Where is the error? Follow the code:

# Abre o arquivo redacao.txt para escrita:
with open("/home/mayna/Downloads/Leo/uniao.csv", "w", dtype=float) as file:

# Percorre a lista de arquivos a serem lidos:
    for temp in ["/home/mayna/Downloads/Leo/B116353_2018_FILTRADO.csv", "/home/mayna/Downloads/Leo/B116354_2018_FILTRADO.csv"]:

        # Abre cada arquivo para leitura:
        with open(temp, "r") as t:

            # Escreve no arquivo o conteúdo:
            file.writelines(t)

Thank you!

  • which version of python is using?

  • I’m using version 3.7.3

1 answer

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.