如何解决“索引0超出轴0尺寸0的范围”?

时间:2019-08-23 03:20:35

标签: python

我正在练习Python。 运行下面的代码将导致错误。 我不知道为什么。

    def plot_conv_south_2(sf, title, south, color):
        df = read_shapefile(sf)
        CTP_KOR_ID = []
        for i in south:
            i = conv_south(i).upper()
            CTP_KOR_ID.append(df[df.CTP_KOR_NM == i.upper()]
                             .index.get_values()[0])
        plot_map_fill_multiples_ids(title, CTP_KOR_ID, sf, 
                                           x_lim = None, 
                                           y_lim = None, 
                                           figsize = (11,9), 
                                           color = color);

AA = ['aaa', 'bbb', 'ccc', 'ddd']

plot_conv_south_2(sf, 'South', AA, 'c')


---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-104-c2d1c4f0d535> in <module>
----> 1 plot_conv_south_2(sf, 'South', AA, 'c')

<ipython-input-102-27a5c1d3a5cb> in plot_conv_south_2(sf, title, south, color)
      8         i = conv_south(i).upper()
      9         CTP_KOR_ID.append(df[df.CTP_KOR_NM == i.upper()]
---> 10                          .index.get_values()[0])
     11     i = np.array(i)
     12     plot_map_fill_multiples_ids(title, CTP_KOR_ID, sf, 

IndexError:索引0超出了大小为0的轴0的边界

0 个答案:

没有答案