In [1]: import scipy
In [2]: scipy.version.full_version
Out[2]: '0.17.1'
In [3]: pwd
Out[3]: u'C:\\Users\\xuedagong\\Documents'
In [4]: import scipy as sp
In [6]: data=sp.genfromtxt("web_traffic.tsv",delimiter="\t")
In [7]: print ( data[:10])
[[ 1.00000000e+00 2.27200000e+03]
[ 2.00000000e+00 nan]
[ 3.00000000e+00 1.38600000e+03]
[ 4.00000000e+00 1.36500000e+03]
[ 5.00000000e+00 1.48800000e+03]
[ 6.00000000e+00 1.33700000e+03]
[ 7.00000000e+00 1.88300000e+03]
[ 8.00000000e+00 2.28300000e+03]
[ 9.00000000e+00 1.33500000e+03]
[ 1.00000000e+01 1.02500000e+03]]
In [8]: print(data.shape)
(743L, 2L)
In [9]: x=data[:,0]
In [10]: print(x[:10])
[ 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.]
In [11]: y=data[:,1]
In [12]: print(y[:10])
[ 2272. nan 1386. 1365. 1488. 1337. 1883. 2283. 1335. 1025.]
Scipy的学习手记
最新推荐文章于 2024-06-30 10:47:26 发布