2017年12月29日 星期五

Python - 清單刪除重複元素,保留原清單排序的作法 - How to remove all duplicate items from a list

版本:

System version : Windows 10  64-bit
Python version : Python 3.6.0 :: Anaconda 4.3.1 (64-bit)
list1=[1,2,4,3,1,2]
list1_remove_duplicate = sorted(set(list1),key=list1.index)
print(list1_remove_duplicate)

執行結果

[1, 2, 4, 3]

2017年12月27日 星期三

Python - Python 3.6.0 Anaconda 4.3.1安裝statsmodels 8.0.0失敗

版本:

System version : Windows 10 64-bit
Python version : Python 3.6.0 :: Anaconda 4.3.1 (64-bit)
使用pip 安裝會出現以下錯誤訊息
    Exception: Cython-generated file 'statsmodels/tsa/kalmanf/kalman_loglike.c' not found.
            Cython is required to compile statsmodels from a development branch.
            Please install Cython or download a source release of statsmodels.
使用conda安裝,可以成功,但import statsmodels後無法正常使用。
到第三方網站下載合適版本的wheel
第三方網站連結:
Python36 windows64 64-bit statsmodels-0.8.0的下載連結:
wheel依個人環境與版本不同,請自行更改
開啟cmd將目錄換到wheel存放的目錄,安裝
pip install  statsmodels-0.8.0-cp36-cp36m-win_amd64.whl