-1
#letalidade por estado
letalidadeRegionalSaude = []
for i in range(len(regional_saude)):
letalidadeRegionalSaude.append(regional_saude.obitosNovos[i] * 100 / regional_saude.casosNovos[i])
print(letalidadeRegionalSaude)
[0.9345794392523364,
4.123711340206185,
3.4618410700236035,
1.7267267267267268,
4.545454545454546
...]
type(letalidadeRegionalSaude[1])
numpy.float64
#Adicionando uma coluna ao DataFrame
regional_saude['letalidadeRegionalSaude'] = pd.Series(letalidadeRegionalSaude)
regional_saude.head()
nomeRegiaoSaude casosNovos obitosNovos populacaoTCU2019_int letalidadeRegionalSaude
10ª REGIAO 428 4 22328916.0 NaN
letalidadeRegionalSaude
is a series not a number, so theNaN
.– Augusto Vasques
I don’t understand!!! But it is not possible to insert a list as a column in a dataframe? Because my intention is this: convert a list with the "pd.Series()" method and put this series as a column in the dataframe.
– jrCleber
Because that’s what I did with the column "populaTCU2019_int". This column was like "Object", I convert it to integer and insert it in the dataframe.
– jrCleber
Convert the series to string that will achieve the desired result.
– Augusto Vasques