-1

我的代码需要使用set_index.

我进口:

    import sys
    import io  
    import csv   
    import math   
    from pandas import *   
    import numpy as np

我以为这就足够了。它没有,因为我收到一个:

NameError:名称set_index未定义。

我正在使用来自 PyPI(Riverbank 计算)的 iPython EPDFree 和 pandas。有没有我忽略的模块?

4

1 回答 1

4

set_index() is a method of DataFrames, not a standalone function. Are you calling it as a method e.g. df.set_index(idx)? Is it still giving you that NameError if you are doing it that way?

于 2012-09-20T19:02:55.020 回答