我正在使用地理数据框。这是一张世界地图。
以下是主要系列的前10个项目:
country:
Afghanistan
Albania
Algeria
Angola
Antigua and Barbuda
Argentina
Armenia
Australia
Austria
Azerbaijan
population:
30552000
3173000
39208000
21472000
90000
41446000
2977000
23343000
8495000
9413000
我已经使用以下方法计算了人口密度:
map1['population_density'] = map1['population'] / map1.geometry.area * 10**6
我得到:
population_density:
4.88E+11
1.04E+12
1.84E+11
2.07E+11
2.35E+12
1.49E+11
9.50E+11
3.35E+10
8.46E+11
1.03E+12
所以最后我得到了这种地理数据框:
| | country_fao | country_wld | ISO_A3 | geometry | population | population_density |
|-------------|---------------------|---------------------|----------|---------------------------------------------------|--------------------|--------------|
| 0 | Afghanistan | Afghanistan | AFG | POLYGON ((71.04980228700009 38.40866445000009,... | 30552000 | 4.881161e+11 |
| 1 | Albania | Albania | ALB | POLYGON ((19.74776574700007 42.57890085900007,... | 3173000 | 1.043958e+12 |
| 2 | Algeria | Algeria | DZA | POLYGON ((8.602510428642177 36.93951076347057,... | 39208000 | 1.843426e+11 |
| 3 | Angola | Angola | AGO | (POLYGON ((11.73751945100014 -16.6925779829998... | 21472000 | 2.072878e+11 |
| 4 | Antigua and Barbuda | Antigua and Barbuda | ATG | (POLYGON ((-61.77301998599992 17.1265322940001... | 90000 | 2.345681e+12 |
问题是当我.describe()时,我得到的最小值和最大值都不正确:
map1.population_density.describe()
输出:
count 1.820000e+02
mean 1.714735e+15
std 2.310953e+16
min 1.537895e+10
25% 2.857549e+11
50% 8.317185e+11
75% 1.829230e+12
max 3.117664e+17
Name: population_density, dtype: float64
当我想绘制地图时。大多数人口密度值都将被忽略。
from mpl_toolkits.axes_grid1 import make_axes_locatable
fig, ax = plt.subplots(1, 1)
divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="5%", pad=0.1)
map1.plot(column='population_density', ax=ax, legend=True, cax=cax)
这是地图的屏幕截图:
我主要要担心的是为什么种群密度未返回正确的最小值和最大值。它的类型是float64。