data mining 2 (import numpy, pandas )

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 2
1 2
2 3
3 4
4 5
5 3
dtype: int64
one 3
two 4
three 5
four 6
five 7
dtype: int64
one two three four five six seven
0 a b c 2 NaN NaN NaN
1 2 3 1 2 3.0 4.0 6.0
one three two
0 3 2 3
1 3 3 4
2 3 3 5
one two three four five six seven
0 a b c 2 NaN NaN NaN
1 2 3 1 2 3.0 4.0 6.0 one two three four five six seven
0 a b c 2 NaN NaN NaN
1 2 3 1 2 3.0 4.0 6.0 one two three four five six seven
0 a b c 2 NaN NaN NaN
1 2 3 1 2 3.0 4.0 6.0 one two three four five six seven
0 a b c 2 NaN NaN NaN
1 2 3 1 2 3.0 4.0 6.0 four five six seven
count 2.0 1.0 1.0 1.0
mean 2.0 3.0 4.0 6.0
std 0.0 NaN NaN NaN
min 2.0 3.0 4.0 6.0
25% 2.0 3.0 4.0 6.0
50% 2.0 3.0 4.0 6.0
75% 2.0 3.0 4.0 6.0
max 2.0 3.0 4.0 6.0 0 1
one a 2
two b 3
three c 1
four 2 2
five NaN 3
six NaN 4
seven NaN 6




转载于:https://www.cnblogs.com/rabbittail/p/7724134.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值