[英]not able to load .pkl file
我有一個存儲在 .pkl 文件中的數據集,我正在嘗試讀取該文件,並使用以下代碼。
with open('file.pkl', 'rb') as f:
data = pickle.load(f)
這是錯誤:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xa3 in position 4: ordinal not in range(128)
在嘗試時
with open(wesad_path, 'r', encoding='utf-8') as f:
data = pickle.load(f)
這是錯誤:
TypeError: a bytes-like object is required, not 'str'
我從未處理過 .pkl 文件,因此感謝您提供任何幫助。
我得到了解決方案:
data = pd.read_pickle(filename)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.