numpy: process the data& array
pandas:data analysis and explore
matplotlib:show with mat &plot
scipy: matrix integration
statsmodels: statistic
Gensim:tex mining
sklearn、keras:computing learning’
numpy:
import numpy as nn a=nn.array(["element1","element2","1","8a"]) a.sort() b=nn.array([["key1","key2"],["1","2","0"],["a","2","0b"]]) b.sort() print(a,b) a1=a[0:4] a2=a[:3] a3=a[1:] b1=b.max() print(a[0],a1,a2,a3) print(b[0][1],b1) pandas:
import pandas as p c=p.Series([2,2,3,4,5,3]) print(c) c1=p.Series([3,4,5,6,7],index=["one","two","three","four","five"]) print(c1) d=p.DataFrame([["a","b","c",2],[2,3,1,2,3,4,6]],columns=["one","two","three","four","five","six","seven"]) print(d) d1=p.DataFrame({ "one":3, "two":[3,4,5], "three":list(str(233)) }) print(d1) d2=d.head()#first five lines d3=d.head(2) d4=d.tail()#last five lines d5=d.tail(3) d6=d.describe() d7=d.T# trans line to column print(d2,d3,d4,d5,d6,d7)
['1' '8a' 'element1' 'element2'] [list(['1', '2', '0']) list(['a', '2', '0b']) list(['key1', 'key2'])]
1 ['1' '8a' 'element1' 'element2'] ['1' '8a' 'element1'] ['8a' 'element1' 'element2']2 ['key1', 'key2']0 21 22 33 44 55 3dtype: int64one 3two 4three 5four 6five 7dtype: int64 one two three four five six seven0 a b c 2 NaN NaN NaN1 2 3 1 2 3.0 4.0 6.0 one three two0 3 2 31 3 3 42 3 3 5 one two three four five six seven0 a b c 2 NaN NaN NaN1 2 3 1 2 3.0 4.0 6.0 one two three four five six seven0 a b c 2 NaN NaN NaN1 2 3 1 2 3.0 4.0 6.0 one two three four five six seven0 a b c 2 NaN NaN NaN1 2 3 1 2 3.0 4.0 6.0 one two three four five six seven0 a b c 2 NaN NaN NaN1 2 3 1 2 3.0 4.0 6.0 four five six sevencount 2.0 1.0 1.0 1.0mean 2.0 3.0 4.0 6.0std 0.0 NaN NaN NaNmin 2.0 3.0 4.0 6.025% 2.0 3.0 4.0 6.050% 2.0 3.0 4.0 6.075% 2.0 3.0 4.0 6.0max 2.0 3.0 4.0 6.0 0 1one a 2two b 3three c 1four 2 2five NaN 3six NaN 4seven NaN 6