Python 迭代帧失败

Python 迭代帧失败,python,pandas,Python,Pandas,我对python非常陌生。我最近下载了这个项目,用于分析reddit上的股票趋势。该项目位于 他们在Procces.py中有代码 def calculate_df(df): data_df = df.filter(['tickers', 'score', 'sentiment']) tickers_processed = pd.DataFrame(df.tickers.explode().value_counts()) tickers_processed = ticke

我对python非常陌生。我最近下载了这个项目,用于分析reddit上的股票趋势。该项目位于

他们在Procces.py中有代码

def calculate_df(df):
    data_df = df.filter(['tickers', 'score', 'sentiment'])

    tickers_processed = pd.DataFrame(df.tickers.explode().value_counts())
    tickers_processed = tickers_processed.rename(columns = {'tickers':'counts'})

    tickers_processed['score'] = 0.0
    tickers_processed['sentiment'] = 0.0

    for idx, row_tick in enumerate(tickers_processed.iloc):
当我试图枚举
ticker\u processed.iloc

发生异常:NotImplementedError 这是不可容忍的

堆栈轨迹:

文件“C:\Users\MyUser\Desktop\NLP\trading bot base\tickerain\process.py”,第113行,在calculate\u df中 对于idx,枚举中的行勾号(tickers\u processed.iloc): 文件“C:\Users\MyUser\Desktop\NLP\trading bot base\tickerain\process.py”,第152行,已处理 返回计算测向(df),计算测向(df_3),计算测向(df_1)

我看了一些其他的问题,他们说试着做类似的事情:

for idx, row_tick in tickers_processed.iloc[::1]

我试过了,但也没用。有人知道如何枚举iloc吗?

尝试使用
df.iterrows()


我认为你不需要在那里列举。。对于idx,etickers\u processed.iterrows()中的行\u勾选:应该可以正常工作。同意,我错过了。更新。非常感谢(我可能需要几个小时才能接受答案),我会在今晚回到项目后尝试此方法。很好,很高兴提供帮助。谢谢,我已经验证我现在可以通过此错误:)
for idx, row_tick in tickers_processed.iterrows():
    ...