熊猫drop_duplicates->致命Python错误:取消分配无

时间:2019-04-05 20:06:36

标签: python pandas drop-duplicates

我有一个检查Excel工作表的代码,如果发现一些更改,则对整个工作表进行快照(Pandas Dataframe)并将其保存到带有时间戳的csv中。 它已经整天运行了,可以正常工作,但是通常一天一次或两次,我收到以下错误消息:

Fatal Python error: deallocating None

Current thread 0x000013d4 (most recent call first):
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\algorithms.py", line 1655 in take_nd
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\internals\blocks.py", line 1238 in take_nd
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\internals\managers.py", line 1235 in <listcomp>
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\internals\managers.py", line 1235 in reindex_indexer
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\internals\managers.py", line 1350 in take
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\generic.py", line 3359 in _take
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\frame.py", line 2969 in _getitem_bool_array
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\frame.py", line 2918 in __getitem__
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\frame.py", line 4637 in drop_duplicates
  File "C:\Python projects\RTD_recorder_1thrd_Pandas.py", line 79 in <module>

这是导致冻结的代码:

final_result = pd.concat([final_result, difference]).drop_duplicates(keep="first", subset=indexes)

有人知道这里可能出什么问题吗? 如果有帮助,请参见以下完整代码:https://www.codepile.net/pile/BRx6W2e0

0 个答案:

没有答案