NumPy(Numeric Python)使用方法


NumPy官網

參考:《Python數據分析基礎教程:NumPy學習指南》

用Python做科學計算(好東西)

NumPy是python的核心庫,是python機器學習編程的最底層的庫,不能不會。

Scipy 和 Scikit 老是傻傻分不清,其實很明顯 Scipy 前面是Sci是num的繼承,而kit則是工具箱,是做機器學習的,全稱Scikit-learn。

NumPy的詳細教程

 

http://numpy.readthedocs.org/

CPython:Python的一種實現方式

IPython:shell交互工具


直接使用pip install安裝需要電腦安裝有C編譯器,更為簡單的方式是下載預編譯的包,具體過程如下:

官網下載程序包,下載對應操作系統的預編譯安裝包,需要根據python版本是2.x還是3.x,系統是32位還是64位進行選擇。

使用pip包管理器進行安裝,在命令行中輸入,pip install 下載scipy安裝包的路徑。

pip install C:\Users\xin\AppData\Local\Programs\Python\Python35\scipy-0.18.1-cp35-cp35m-win_amd64.whl

可以安裝成功,但若想使用,必須先安裝 numpy+mkl,安裝完后最好重啟一下IPython,不然import會報錯。

pip install C:\Users\xin\AppData\Local\Programs\Python\Python35\numpy-1.12.0b1+mkl-cp35-cp35m-win_amd64.whl

安裝Scikit-learn很順利,但是import就報錯

TypeError: unorderable types: str() < int()

查了很多資料,需要改代碼

C:\Users\xin\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\utils\fixes.py

The problem is out on the version number,so maybe You could try to revise fixs.py in the sklearn folder.Add these script after the "try" in line 32:
if not (x.isdigit()):
x='0'
so your codes will be:

def _parse_version(version_string):
version = []
for x in version_string.split('.'):
    try:
        if not (x.isdigit()):
            x='0'
        version.append(int(x))
        #print(x)
    except ValueError:
        # x may be of the form dev-1ea1592
        version.append(x)
return tuple(version)


NumPy中的數組相當於Python中的list容器

 

 

 

待續~


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM