2014-04-25 16 views

Trả lời

12

Để tìm thấy nó trên hệ thống của riêng bạn, hãy thử inspect:

import inspect 
from numpy import percentile 
inspect.getfile(percentile) 
+3

Để in nguồn: 'print (inspect.getsource (numpy.percentile))' – jfs

8

Mã nguồn của numpy là trong Github và chức năng phần trăm có thể được tìm thấy trên line 3076 in lib/function_base.py

+0

Để ghi lại hàm phần trăm bây giờ là trên [line 3796] (https://github.com/numpy/numpy/blob/ master/numpy/lib/function_base.py # L3796) của lib/function_base.py trong bản gốc. – Meredith

5

Với ipython bạn có thể xem mã nguồn mã bằng cách đặt ?? (hai dấu hỏi) sau hàm,

from numpy import percentile 

percentile?? 
3

Các source chức năng trong numpy

from numpy import percentile, source 
print source(percentile) 

chí đầu ra mã nguồn.

Các vấn đề liên quan