我正试图在世界地图上绘制国家地图。发生的问题是只有美国被显示在输出上。

问题描述 投票:0回答:1
fig = px.scatter_geo(df, locations="country", color = "country",
                                  projection="natural earth")
fig.show()

在输出端,我能够得到世界地图,在图例中,所有国家都出现了。问题是地图上没有显示国家。

下面是样本数据的快照。

{'id': {0: '72b83200-4881-4806-b910-af86905256c4',
  1: '5db5df19-c06b-489a-b2f4-c2ffc26643ba',
  2: '6c9e4f0d-ef87-497f-97af-df207a25331d',
  3: '004bf779-368d-47ae-b3cc-07b0ecad2464',
  4: '8a2265d9-1f81-4c47-953f-0d4bfab326c0'},
 'name': {0: 'BALCO BRANDS PTY LTD',
  1: 'Bambury',
  2: 'Bata Shoe Company of Australia',
  3: 'Bean Body Care',
  4: 'Caprice Australia '},
 'canonical_name': {0: 'balcobrands',
  1: 'bambury',
  2: 'batashoecompanyofaustralia',
  3: 'beanbodycare',
  4: 'capriceaustralia'},
 'url': {0: 'http://www.balcobrands.com',
  1: 'http://www.bambury.com.au',
  2: 'http://www.bataindustrials.com.au',
  3: 'https://global.beanbodycare.com',
  4: 'http://www.caprice.com.au'},
 'type': {0: 3, 1: 3, 2: 3, 3: 3, 4: 3},
 'address': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 'city': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 'state': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 'country': {0: 'Australia',
  1: 'Australia',
  2: 'Australia',
  3: 'Australia',
  4: 'Australia'},
 'country_code': {0: 'AU', 1: 'AU', 2: 'AU', 3: 'AU', 4: 'AU'},
 'created_at': {0: '2020-04-01 20:52:38.098099',
  1: '2020-04-01 20:52:38.364935',
  2: '2020-04-01 20:52:38.636768',
  3: '2020-04-01 20:52:38.951573',
  4: '2020-04-01 20:52:39.271376'},
 'created_by': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan},
 'updated_at': {0: '2020-04-01 20:52:38.098099',
  1: '2020-04-01 20:52:38.364935',
  2: '2020-04-01 20:52:38.636768',
  3: '2020-04-01 20:52:38.951573',
  4: '2020-04-01 20:52:39.271376'},
 'updated_by': {0: nan, 1: nan, 2: nan, 3: nan, 4: nan}}
python plotly geopandas
1个回答
0
投票

数据中没有包含三位数的国家代码。当数据与另一个有三位数国家代码的数据集合并时,得到了所需的输出。

© www.soinside.com 2019 - 2024. All rights reserved.