久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='sqU7j'></tfoot>

      <bdo id='sqU7j'></bdo><ul id='sqU7j'></ul>
    1. <small id='sqU7j'></small><noframes id='sqU7j'>

        <legend id='sqU7j'><style id='sqU7j'><dir id='sqU7j'><q id='sqU7j'></q></dir></style></legend>
      1. <i id='sqU7j'><tr id='sqU7j'><dt id='sqU7j'><q id='sqU7j'><span id='sqU7j'><b id='sqU7j'><form id='sqU7j'><ins id='sqU7j'></ins><ul id='sqU7j'></ul><sub id='sqU7j'></sub></form><legend id='sqU7j'></legend><bdo id='sqU7j'><pre id='sqU7j'><center id='sqU7j'></center></pre></bdo></b><th id='sqU7j'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='sqU7j'><tfoot id='sqU7j'></tfoot><dl id='sqU7j'><fieldset id='sqU7j'></fieldset></dl></div>
      2. Folium Choropleth + GeoJSON 引發 AttributeError: 'NoneT

        Folium Choropleth + GeoJSON raises AttributeError: #39;NoneType#39;(Folium Choropleth + GeoJSON 引發 AttributeError: NoneType)
      3. <small id='nJDRU'></small><noframes id='nJDRU'>

            • <bdo id='nJDRU'></bdo><ul id='nJDRU'></ul>

                1. <i id='nJDRU'><tr id='nJDRU'><dt id='nJDRU'><q id='nJDRU'><span id='nJDRU'><b id='nJDRU'><form id='nJDRU'><ins id='nJDRU'></ins><ul id='nJDRU'></ul><sub id='nJDRU'></sub></form><legend id='nJDRU'></legend><bdo id='nJDRU'><pre id='nJDRU'><center id='nJDRU'></center></pre></bdo></b><th id='nJDRU'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='nJDRU'><tfoot id='nJDRU'></tfoot><dl id='nJDRU'><fieldset id='nJDRU'></fieldset></dl></div>
                    <tbody id='nJDRU'></tbody>

                  <legend id='nJDRU'><style id='nJDRU'><dir id='nJDRU'><q id='nJDRU'></q></dir></style></legend>
                  <tfoot id='nJDRU'></tfoot>

                  本文介紹了Folium Choropleth + GeoJSON 引發 AttributeError: 'NoneType'的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試使用 folium 做一個 choropleth,它提供了 GeoJSON 之間的一個很好的鏈接,熊貓和傳單.

                  I'm trying to do a choropleth using folium which offers a great link between GeoJSON, Pandas and leaflet.

                  GeoJSON 格式如下:

                  GeoJSON format is like below :

                  {
                    "type":"FeatureCollection",
                    "features":[
                          {
                            "type":"Feature",
                            "geometry":
                            {
                                "type":"Polygon",
                                "coordinates":[[[-1.6704591323124895,49.62681486270549], .....
                                {
                                    "insee":"50173",
                                    "nom":"équeurdreville-Hainneville",
                                    "wikipedia":"fr:équeurdreville-Hainneville",
                                    "surf_m2":12940306}},
                  

                  熊貓數據框:

                  postal_count.head(5)
                  Out[98]: 
                    Code_commune_INSEE  CP_count
                  0              75120       723
                  1              75115       698
                  2              75112       671
                  3              75118       627
                  4              75111       622
                  

                  Code_communes_INSEE"對應于 GeoJSON 中的屬性insee".我想在上面的 DataFrame 中使用變量CP_count"做一個等值線.

                  "Code_communes_INSEE" corresponds to the attribute "insee" in the GeoJSON. I'd like to do a choropleth using the variable "CP_count" in the above DataFrame.

                  這是我的代碼(來自 這個筆記本)

                  Here is my code (snippet from this notebook)

                  map_france = folium.Map(location=[47.000000, 2.000000], zoom_start=6)
                  map_france.choropleth(
                                      geo_str=open(geo_path + 'simplified_communes100m.json').read(),
                                      data=postal_count,
                                      columns=['Code_commune_INSEE', 'CP_count'],
                                      key_on='feature.geometry.properties.insee',
                                      fill_color='YlGn',
                  )
                  map_france.save(table_path + 'choro_test1.html')
                  

                  我仍然一次又一次地收到此錯誤:

                  I'm still getting this error again and again :

                  ---------------------------------------------------------------------------
                  AttributeError                            Traceback (most recent call last)
                  <ipython-input-83-ea0fd2c1c207> in <module>()
                        8                     fill_color='YlGn',
                        9 )
                  ---> 10 map_france.save('/media/flo/Stockage/Data/MesAides/map/choro_test1.html')
                  
                  /home/flo/.virtualenvs/mesaides/lib/python3.4/site-packages/folium/element.py in save(self, outfile, close_file, **kwargs)
                      151 
                      152         root = self.get_root()
                  --> 153         html = root.render(**kwargs)
                      154         fid.write(html.encode('utf8'))
                      155         if close_file:
                  
                  /home/flo/.virtualenvs/mesaides/lib/python3.4/site-packages/folium/element.py in render(self, **kwargs)
                      357         """Renders the HTML representation of the element."""
                      358         for name, child in self._children.items():
                  --> 359             child.render(**kwargs)
                      360         return self._template.render(this=self, kwargs=kwargs)
                      361 
                  
                  /home/flo/.virtualenvs/mesaides/lib/python3.4/site-packages/folium/element.py in render(self, **kwargs)
                      665 
                      666         for name, element in self._children.items():
                  --> 667             element.render(**kwargs)
                  
                  /home/flo/.virtualenvs/mesaides/lib/python3.4/site-packages/folium/element.py in render(self, **kwargs)
                      661         script = self._template.module.__dict__.get('script', None)
                      662         if script is not None:
                  --> 663             figure.script.add_children(Element(script(self, kwargs)),
                      664                                        name=self.get_name())
                      665 
                  
                  /home/flo/.virtualenvs/mesaides/lib/python3.4/site-packages/jinja2/runtime.py in __call__(self, *args, **kwargs)
                      434             raise TypeError('macro %r takes not more than %d argument(s)' %
                      435                             (self.name, len(self.arguments)))
                  --> 436         return self._func(*arguments)
                      437 
                      438     def __repr__(self):
                  
                  <template> in macro(l_this, l_kwargs)
                  
                  /home/flo/.virtualenvs/mesaides/lib/python3.4/site-packages/jinja2/runtime.py in call(_Context__self, _Context__obj, *args, **kwargs)
                      194                 args = (__self.environment,) + args
                      195         try:
                  --> 196             return __obj(*args, **kwargs)
                      197         except StopIteration:
                      198             return __self.environment.undefined('value was undefined because '
                  
                  /home/flo/.virtualenvs/mesaides/lib/python3.4/site-packages/folium/features.py in style_data(self)
                      352 
                      353         for feature in self.data['features']:
                  --> 354             feature.setdefault('properties', {}).setdefault('style', {}).update(self.style_function(feature))  # noqa
                      355         return json.dumps(self.data, sort_keys=True)
                      356 
                  
                  /home/flo/.virtualenvs/mesaides/lib/python3.4/site-packages/folium/folium.py in style_function(x)
                      671                 "color": line_color,
                      672                 "fillOpacity": fill_opacity,
                  --> 673                 "fillColor": color_scale_fun(x)
                      674             }
                      675 
                  
                  /home/flo/.virtualenvs/mesaides/lib/python3.4/site-packages/folium/folium.py in color_scale_fun(x)
                      659             def color_scale_fun(x):
                      660                 return color_range[len(
                  --> 661                     [u for u in color_domain if
                      662                      u <= color_data[get_by_key(x, key_on)]])]
                      663         else:
                  
                  /home/flo/.virtualenvs/mesaides/lib/python3.4/site-packages/folium/folium.py in <listcomp>(.0)
                      660                 return color_range[len(
                      661                     [u for u in color_domain if
                  --> 662                      u <= color_data[get_by_key(x, key_on)]])]
                      663         else:
                      664             def color_scale_fun(x):
                  
                  /home/flo/.virtualenvs/mesaides/lib/python3.4/site-packages/folium/folium.py in get_by_key(obj, key)
                      655                 return (obj.get(key, None) if len(key.split('.')) <= 1 else
                      656                         get_by_key(obj.get(key.split('.')[0], None),
                  --> 657                                    '.'.join(key.split('.')[1:])))
                      658 
                      659             def color_scale_fun(x):
                  
                  /home/flo/.virtualenvs/mesaides/lib/python3.4/site-packages/folium/folium.py in get_by_key(obj, key)
                      655                 return (obj.get(key, None) if len(key.split('.')) <= 1 else
                      656                         get_by_key(obj.get(key.split('.')[0], None),
                  --> 657                                    '.'.join(key.split('.')[1:])))
                      658 
                      659             def color_scale_fun(x):
                  
                  /home/flo/.virtualenvs/mesaides/lib/python3.4/site-packages/folium/folium.py in get_by_key(obj, key)
                      653 
                      654             def get_by_key(obj, key):
                  --> 655                 return (obj.get(key, None) if len(key.split('.')) <= 1 else
                      656                         get_by_key(obj.get(key.split('.')[0], None),
                      657                                    '.'.join(key.split('.')[1:])))
                  
                  AttributeError: 'NoneType' object has no attribute 'get'
                  

                  我嘗試使用 key_on='feature.geometry.properties.insee' 沒有任何成功.

                  I tried playing with key_on='feature.geometry.properties.insee' without any success.

                  推薦答案

                  有2個問題:

                  1 - 對insee"參數的正確訪問是:key_on='feature.properties.insee'

                  1 - The correct access to 'insee' parameters is : key_on='feature.properties.insee'

                  找到正確的 key_on 的最佳方法是使用 geoJSON dict 以確保調用正確的屬性.

                  The best way to find the right key_on is to play with the geoJSON dict to make sure you are calling the right properties.

                  2- 獲得正確的 key_on 參數后,您需要確保 geoJSON 中的所有可用鍵 都包含在 Pandas DataFrame 中(否則它將引發 KeyError)

                  2- Once you have the right key_on parameters, you need to make sure that all the available keys in the geoJSON are contained in your Pandas DataFrame (otherwise it will raise a KeyError)

                  在這種情況下,我使用以下命令行來獲取我的 geoJSON 包含的所有 insee 鍵:

                  In this case, I used the following command line to get all the insee keys contained by my geoJSON:

                  ogrinfo -ro -al communes-20150101-100m.shp -geom=NO | grep insee > list_code_insee.txt
                  

                  如果您遇到同樣的問題,這應該可以解決您的問題.

                  If you are experiencing the same issue, this should solve your problem.

                  這篇關于Folium Choropleth + GeoJSON 引發 AttributeError: 'NoneType'的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Plotting OpenStreetMap relations does not generate continous lines(繪制 OpenStreetMap 關系不會生成連續線)
                  Overlay image on R leaflet map(R傳單地圖上的疊加圖像)
                  How to share pandas DataFrame object between processes?(如何在進程之間共享 pandas DataFrame 對象?)
                  Convert strings to float in all pandas columns, where this is possible(在所有 pandas 列中將字符串轉換為浮點數,這是可能的)
                  pandas - how to convert all columns from object to float type(pandas - 如何將所有列從對象轉換為浮點類型)
                  Converting pandas.DataFrame to bytes(將 pandas.DataFrame 轉換為字節)
                    <legend id='waWTb'><style id='waWTb'><dir id='waWTb'><q id='waWTb'></q></dir></style></legend>
                        <tbody id='waWTb'></tbody>

                        <bdo id='waWTb'></bdo><ul id='waWTb'></ul>
                      • <small id='waWTb'></small><noframes id='waWTb'>

                          <i id='waWTb'><tr id='waWTb'><dt id='waWTb'><q id='waWTb'><span id='waWTb'><b id='waWTb'><form id='waWTb'><ins id='waWTb'></ins><ul id='waWTb'></ul><sub id='waWTb'></sub></form><legend id='waWTb'></legend><bdo id='waWTb'><pre id='waWTb'><center id='waWTb'></center></pre></bdo></b><th id='waWTb'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='waWTb'><tfoot id='waWTb'></tfoot><dl id='waWTb'><fieldset id='waWTb'></fieldset></dl></div>
                          <tfoot id='waWTb'></tfoot>

                            主站蜘蛛池模板: 亚洲色图综合 | 东京av男人的天堂 | 久久高清免费视频 | 午夜小视频在线播放 | 欧美激情在线精品一区二区三区 | 久久国产精品无码网站 | 日韩视频一区二区 | av毛片 | 91观看 | 日韩av大片免费看 | 色射综合 | 午夜影院在线观看免费 | 精品国偷自产在线 | 中文字幕精品视频 | 国产一区二区电影 | 亚洲精品aⅴ | 久久久久久久久久久丰满 | 国产一二区在线 | 久久久免费观看视频 | 黄色小视频大全 | 国产精品久久久久久久久久 | 黄视频国产 | 污污的网站在线观看 | 午夜寂寞影院在线观看 | 久久久久免费精品国产小说色大师 | 91综合在线视频 | 久久成人国产精品 | 中文字幕在线一区二区三区 | 色综合久久久久 | h在线免费观看 | 精品欧美一区二区三区久久久 | 99精品在线观看 | 欧洲av一区 | 欧美一区二区三区在线 | 古装三级在线播放 | 伊人婷婷| 成人精品视频在线观看 | 中文字幕av在线 | 亚洲精品亚洲人成人网 | 欧美亚洲国语精品一区二区 | 欧美成人免费在线视频 |