0
Hello,
I have a file . csv that I am trying to pass to json
Produtos Quantidade
Bala 50
Refri NaN
Salgado 25
And I’m importing for a json, wanted to know how to ignore the Nan values and return the sum.
This is the code:
df = pd.read_csv(r"quantida.csv", sep=";")
totalQuantidade = sum(data['Quantidade'])
dataJSON = {
"Volume": totalQuantidade
}
#Escrever no JSON
with open('estoque.json', 'w') as jsonFile:
jsonFile.write(json.dumps(dataJSON, indent=4))
print('Concluído')