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 []:
网友评论