hiDaDeng / cntext

文本分析包,支持字数统计、可读性、文档相似度、情感分析在内的多种文本分析方法。chinese text sentiment analysis
MIT License
277 stars 28 forks source link

调用ChineseEmoBank.pkl失败 #20

Open rongbinf opened 11 months ago

rongbinf commented 11 months ago

其他词典(如HOWNET,正常)

print(ct.__version__)
# 导入pkl词典文件,
print(ct.load_pkl_dict('ChineseEmoBank.pkl'))

报错:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[51], line 3
      1 print(ct.__version__)
      2 # 导入pkl词典文件,
----> 3 print(ct.load_pkl_dict('ChineseEmoBank.pkl'))

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\cntext\stats.py:32, in load_pkl_dict(file, is_builtin)
     30 else:
     31     dict_f = open(file, 'rb')
---> 32 dict_obj = pickle.load(dict_f)
     33 return dict_obj

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\core\internals\blocks.py:2400, in new_block(values, placement, ndim, refs)
   2388 def new_block(
   2389     values,
   2390     placement: BlockPlacement,
   (...)
   2397     # - check_ndim/ensure_block_shape already checked
   2398     # - maybe_coerce_values already called/unnecessary
   2399     klass = get_block_type(values.dtype)
-> 2400     return klass(values, ndim=ndim, placement=placement, refs=refs)

TypeError: Argument 'placement' has incorrect type (expected pandas._libs.internals.BlockPlacement, got slice)

环境:

Windows 11 x64
python 3.11.4
pandas 2.1.3
cntext 1.8.8
JasonHuang0812 commented 8 months ago

I had this problem too

Liangjunjian1999 commented 5 months ago

Pandas==1.3.3

jebberwocky commented 2 months ago

same issue with pandas = 2.2.1

yaotianzhang commented 4 weeks ago

I solved this problem by installing pandas==2.0.3. Hope it will be helpful to you

jebberwocky commented 3 weeks ago

@yaotianzhang pandas==2.0.3 works with me too 👍