I'm trying to save the values from populatioEst column in float variables using Python3 & Pandas, I have the following table:
| Name | populationEst |
|---|---|
| Amsterdam | 872757 |
| Netherlands | 17407585 |
I have tried to separate both values as following,
populationAM = pops['populationEst'][pops.Name == 'Amsterdam']
populationNL = pops['populationEst'][pops.Name == 'Netherlands']
However when I try to print out the value,print(populationAM), I get this output
0 872757
Name: PopulationEstimate2020-01-01, dtype: int64
and I think that populationAM & populationNL are not int values, because Whenever I try to run some arithmetic operation on them I do not get the desired value.
For example, I have tried to calculate the fraction of the populationAM against populationNL using this formula
frac = populationAM.astype(float) * 100 / populationNL.astype(float)
and I did not get the desired output that should be 5,013659276 but I have got this one:
0 Nan
1 Nan
Name: PopulationEst, dtype: float64
Can Anybody tell where am I going wrong here or how can I save these values in simple float variables.