gpt4 book ai didi

python - 断言错误 : Number of manager items must equal union of block items # manager items: 6004, # tot_items: 6005

转载 作者:行者123 更新时间:2023-12-02 19:34:45 30 4
gpt4 key购买 nike

我的代码:

for column_name, column_data in summary_words.iteritems():
if column_name != "summary" and column_name != "text" and column_name != "score" and column_name != "helpfulness":
summary_words[column_name] = summary_words["summary"].str.count(column_name)

其中 summary_words 是一个 pandas 数据框,“summary”是该数据框中的一列。当我运行代码时出现此错误:

AssertionError: Number of manager items must equal union of block items manager items: 6004, # tot_items: 6005

有谁知道我为什么会收到此错误以及如何修复它?

great   my  This    love    you best    and will    favorite    watch   ... step    succeeds    judge   (who    strictly    things, helpfulness score   summary text
0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN 100.0 3 "There Is So Much Darkness Now ~ Come For The ... Synopsis: On the daily trek from Juarez, Mexic...
1 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN 100.0 3 Worthwhile and Important Story Hampered by Poo... THE VIRGIN OF JUAREZ is based on true events s...
2 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN 80.0 5 This movie needed to be made. The scenes in this film can be very disquietin...
3 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN 100.0 3 distantly based on a real tragedy THE VIRGIN OF JUAREZ (2006)<br />directed by K...
4 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN 100.0 3 "What's going on down in Juarez and shining a ... Informationally, this SHOWTIME original is ess...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
99995 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN 0.0 5 A Great Collection! Gave this for a friends birthday and she LOVES...
99996 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN 0.0 5 TOOOOO FUNNY I had not seen the MP guys for years. I have o...
99997 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN 0.0 5 monty python this is the best flying circus that monty pyth...
99998 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN 0.0 5 Python at its best and purest! If you are a serious Monty Python fan, then th...
99999 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN 0.0 5 Monty Python 16 DVD set I got this as a Christmas gift for my son - th...

最佳答案

很可能您的特殊用途关键字,如 summaryhelpfulness,与您正在分析的词汇表中的单词发生冲突。

您应该能够通过查看长度来快速检查这一点:

len(summary_words.columns)
len(set(summary_words.columns))

查看此 SO Q&A有关多列问题的更多详细信息,在 pd.concat 的上下文中。

关于python - 断言错误 : Number of manager items must equal union of block items # manager items: 6004, # tot_items: 6005,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61236399/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com