In [1]:
importpandasaspdprint"Hi! This is a cell. Press the ? button above to run it"
Hi! This is a cell. Press the ? button above to run it
In?[7]:
defprint_10_nums():foriinrange(10):printi,
In?[8]:
print_10_nums()
0 1 2 3 4 5 6 7 8 9
In?[9]:
%timesum([xforxinrange(100000)])
CPU times: user 24.4 ms, sys: 5.3 ms, total: 29.7 ms
Wall time: 27.1 ms
Out[9]:
4999950000
In?[10]:
%timesum(xforxinrange(100000))
CPU times: user 7.38 ms, sys: 2.95 ms, total: 10.3 ms
Wall time: 8.13 ms
Out[10]:
4999950000
In?[12]:
importnumpyasnpts=pd.Series(np.random.randn(1000),index=pd.date_range('1/1/2000',periods=1000))df=pd.DataFrame(np.random.randn(1000,4),index=ts.index,columns=['A','B','C','D'])df=df.cumsum()df.plot()pylab.show()
In?[]:
Untitled
最后編輯于 :
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
推薦閱讀更多精彩內容
- 最近在寫個性化推薦的論文,經常用到Python來處理數據,被pandas和numpy中的數據選取和索引問題繞的比較...
- 7.3 數據轉換 還有一個重要操作就是 過濾、清理、以及其他的轉換工作。 7.3.1 移除重復數據 DataFra...