
1. 引言
最近在將一個(gè)算法由matlab轉(zhuǎn)成python,初學(xué)python,很多地方還不熟悉,總體感覺(jué)就是上手容易,實(shí)際上很優(yōu)雅地用python還是蠻難的。目前為止,覺(jué)得就算法仿真研究而言,還是matlab用得特別舒服,可能是比較熟悉的緣故吧。matlab直接集成了很多算法工具箱,函數(shù)查詢(xún)、調(diào)用、變量查詢(xún)等非常方便,或許以后用久了python也會(huì)感覺(jué)很好用。與python相比,最喜歡的莫過(guò)于可以直接選中某段代碼執(zhí)行了,操作方便,python也可以實(shí)現(xiàn),就是感覺(jué)不是很方便。
言歸正傳,做算法要用到很多的向量和矩陣運(yùn)算操作,這些嘛在matlab里面已經(jīng)很熟悉了,但用python的時(shí)候需要用一個(gè)查一個(gè),挺煩的,所以在此稍作總結(jié),后續(xù)使用過(guò)程中會(huì)根據(jù)使用體驗(yàn)更新。
python的矩陣運(yùn)算主要依賴(lài)numpy包,scipy包以numpy為基礎(chǔ),大大擴(kuò)展了后者的運(yùn)算能力。
2. 創(chuàng)建一般的多維數(shù)組
import numpy as np
a = np.array([1,2,3], dtype=int) # 創(chuàng)建1*3維數(shù)組 array([1,2,3])
type(a) # numpy.ndarray類(lèi)型
a.shape # 維數(shù)信息(3L,)
a.dtype.name # 'int32'
a.size # 元素個(gè)數(shù):3
a.itemsize #每個(gè)元素所占用的字節(jié)數(shù)目:4
b=np.array([[1,2,3],[4,5,6]],dtype=int) # 創(chuàng)建2*3維數(shù)組 array([[1,2,3],[4,5,6]])
b.shape # 維數(shù)信息(2L,3L)
b.size # 元素個(gè)數(shù):6
b.itemsize # 每個(gè)元素所占用的字節(jié)數(shù)目:4
c=np.array([[1,2,3],[4,5,6]],dtype='int16') # 創(chuàng)建2*3維數(shù)組 array([[1,2,3],[4,5,6]],dtype=int16)
c.shape # 維數(shù)信息(2L,3L)
c.size # 元素個(gè)數(shù):6
c.itemsize # 每個(gè)元素所占用的字節(jié)數(shù)目:2
c.ndim # 維數(shù)
d=np.array([[1,2,3],[4,5,6]],dtype=complex) # 復(fù)數(shù)二維數(shù)組
d.itemsize # 每個(gè)元素所占用的字節(jié)數(shù)目:16
d.dtype.name # 元素類(lèi)型:'complex128'
3. 創(chuàng)建特殊類(lèi)型的多維數(shù)組
a1 = np.zeros((3,4)) # 創(chuàng)建3*4全零二維數(shù)組
輸出:
array([[ 0., 0., 0., 0.],
[ 0., 0., 0., 0.],
[ 0., 0., 0., 0.]])
a1.dtype.name # 元素類(lèi)型:'float64'
a1.size # 元素個(gè)數(shù):12
a1.itemsize # 每個(gè)元素所占用的字節(jié)個(gè)數(shù):8
a2 = np.ones((2,3,4), dtype=np.int16) # 創(chuàng)建2*3*4全1三維數(shù)組
a2 = np.ones((2,3,4), dtype='int16') # 創(chuàng)建2*3*4全1三維數(shù)組
輸出:
array([[[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1]],
[[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1]]], dtype=int16)
a3 = np.empty((2,3)) # 創(chuàng)建2*3的未初始化二維數(shù)組
輸出:(may vary)
array([[ 1., 2., 3.],
[ 4., 5., 6.]])
a4 = np.arange(10,30,5) # 初始值10,結(jié)束值:30(不包含),步長(zhǎng):5
輸出:array([10, 15, 20, 25])
a5 = np.arange(0,2,0.3) # 初始值0,結(jié)束值:2(不包含),步長(zhǎng):0.2
輸出:array([ 0. , 0.3, 0.6, 0.9, 1.2, 1.5, 1.8])
from numpy import pi
np.linspace(0, 2, 9) # 初始值0,結(jié)束值:2(包含),元素個(gè)數(shù):9
輸出:
array([ 0. , 0.25, 0.5 , 0.75, 1. , 1.25, 1.5 , 1.75, 2. ])
x = np.linspace(0, 2*pi, 9)
輸出:
array([ 0. , 0.78539816, 1.57079633, 2.35619449, 3.14159265,
3.92699082, 4.71238898, 5.49778714, 6.28318531])
a = np.arange(6)
輸出:
array([0, 1, 2, 3, 4, 5])
b = np.arange(12).reshape(4,3)
輸出:
array([[ 0, 1, 2],
[ 3, 4, 5],
[ 6, 7, 8],
[ 9, 10, 11]])
c = np.arange(24).reshape(2,3,4)
輸出:
array([[[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]],
[[12, 13, 14, 15],
[16, 17, 18, 19],
[20, 21, 22, 23]]])
使用numpy.set_printoptions可以設(shè)置numpy變量的打印格式
在ipython環(huán)境下,使用help(numpy.set_printoptions)查詢(xún)使用幫助和示例
4. 多維數(shù)組的基本操作
加法和減法操作要求操作雙方的維數(shù)信息一致,均為M*N為數(shù)組方可正確執(zhí)行操作。
a = np.arange(4)
輸出:
array([0, 1, 2, 3])
b = a**2
輸出:
array([0, 1, 4, 9])
c = 10*np.sin(a)
輸出:
array([ 0. , 8.41470985, 9.09297427, 1.41120008])
n < 35
輸出:
array([ True, True, True, True], dtype=bool)
A = np.array([[1,1],[0,1]])
B = np.array([[2,0],[3,4]])
C = A * B # 元素點(diǎn)乘
輸出:
array([[2, 0],
[0, 4]])
D = A.dot(B) # 矩陣乘法
輸出:
array([[5, 4],
[3, 4]])
E = np.dot(A,B) # 矩陣乘法
輸出:
array([[5, 4],
[3, 4]])
多維數(shù)組操作過(guò)程中的類(lèi)型轉(zhuǎn)換
When operating with arrays of different types, the type of the resulting array corresponds to the more general or precise one (a behavior known as upcasting)
即操作不同類(lèi)型的多維數(shù)組時(shí),結(jié)果自動(dòng)轉(zhuǎn)換為精度更高類(lèi)型的數(shù)組,即upcasting
a = np.ones((2,3),dtype=int) # int32
b = np.random.random((2,3)) # float64
b += a # 正確
a += b # 錯(cuò)誤
a = np.ones(3,dtype=np.int32)
b = np.linspace(0,pi,3)
c = a + b
d = np.exp(c*1j)
輸出:
array([ 0.54030231+0.84147098j, -0.84147098+0.54030231j,
-0.54030231-0.84147098j])
d.dtype.name
輸出:
'complex128'
多維數(shù)組的一元操作,如求和、求最小值、最大值等
a = np.random.random((2,3))
a.sum()
a.min()
a.max()
b = np.arange(12).reshape(3,4)
輸出:
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]])
b.sum(axis=0) # 按列求和
輸出:
array([12, 15, 18, 21])
b.sum(axis=1) # 按行求和
輸出:
array([ 6, 22, 38])
b.cumsum(axis=0) # 按列進(jìn)行元素累加
輸出:
array([[ 0, 1, 2, 3],
[ 4, 6, 8, 10],
[12, 15, 18, 21]])
b.cumsum(axis=1) # 按行進(jìn)行元素累加
輸出:
array([[ 0, 1, 3, 6],
[ 4, 9, 15, 22],
[ 8, 17, 27, 38]])
universal functions
B = np.arange(3)
np.exp(B)
np.sqrt(B)
C = np.array([2.,-1.,4.])
np.add(B,C)
其他的ufunc函數(shù)包括:
all, any, apply_along_axis, argmax, argmin, argsort, average, bincount, ceil, clip, conj, corrcoef, cov, cross, cumprod, cumsum, diff, dot, floor,inner, lexsort, max, maximum, mean, median, min, minimum, nonzero, outer, prod, re, round, sort, std, sum, trace, transpose, var,vdot, vectorize, where
5. 數(shù)組索引、切片和迭代
a = np.arange(10)**3
a[2]
a[2:5]
a[::-1] # 逆序輸出
for i in a:
print (i**(1/3.))
def f(x,y):
return 10*x+y
b = np.fromfunction(f,(5,4),dtype=int)
b[2,3]
b[0:5,1]
b[:,1]
b[1:3,:]
b[-1]
c = np.array([[[0,1,2],[10,11,12]],[[100,101,102],[110,111,112]]])
輸出:
array([[[ 0, 1, 2],
[ 10, 11, 12]],
[[100, 101, 102],
[110, 111, 112]]])
c.shape
輸出:
(2L, 2L, 3L)
c[0,...]
c[0,:,:]
輸出:
array([[ 0, 1, 2],
[10, 11, 12]])
c[:,:,2]
c[...,2]
輸出:
array([[ 2, 12],
[102, 112]])
for row in c:
print(row)
for element in c.flat:
print(element)
a = np.floor(10*np.random.random((3,4)))
輸出:
array([[ 3., 9., 8., 4.],
[ 2., 1., 4., 6.],
[ 0., 6., 0., 2.]])
a.ravel()
輸出:
array([ 3., 9., 8., ..., 6., 0., 2.])
a.reshape(6,2)
輸出:
array([[ 3., 9.],
[ 8., 4.],
[ 2., 1.],
[ 4., 6.],
[ 0., 6.],
[ 0., 2.]])
a.T
輸出:
array([[ 3., 2., 0.],
[ 9., 1., 6.],
[ 8., 4., 0.],
[ 4., 6., 2.]])
a.T.shape
輸出:
(4L, 3L)
a.resize((2,6))
輸出:
array([[ 3., 9., 8., 4., 2., 1.],
[ 4., 6., 0., 6., 0., 2.]])
a.shape
輸出:
(2L, 6L)
a.reshape(3,-1)
輸出:
array([[ 3., 9., 8., 4.],
[ 2., 1., 4., 6.],
[ 0., 6., 0., 2.]])
詳查以下函數(shù):
ndarray.shape, reshape, resize, ravel
6. 組合不同的多維數(shù)組
a = np.floor(10*np.random.random((2,2)))
輸出:
array([[ 5., 2.],
[ 6., 2.]])
b = np.floor(10*np.random.random((2,2)))
輸出:
array([[ 0., 2.],
[ 4., 1.]])
np.vstack((a,b))
輸出:
array([[ 5., 2.],
[ 6., 2.],
[ 0., 2.],
[ 4., 1.]])
np.hstack((a,b))
輸出:
array([[ 5., 2., 0., 2.],
[ 6., 2., 4., 1.]])
from numpy import newaxis
np.column_stack((a,b))
輸出:
array([[ 5., 2., 0., 2.],
[ 6., 2., 4., 1.]])
a = np.array([4.,2.])
b = np.array([2.,8.])
a[:,newaxis]
輸出:
array([[ 4.],
[ 2.]])
b[:,newaxis]
輸出:
array([[ 2.],
[ 8.]])
np.column_stack((a[:,newaxis],b[:,newaxis]))
輸出:
array([[ 4., 2.],
[ 2., 8.]])
np.vstack((a[:,newaxis],b[:,newaxis]))
輸出:
array([[ 4.],
[ 2.],
[ 2.],
[ 8.]])
np.r_[1:4,0,4]
輸出:
array([1, 2, 3, 0, 4])
np.c_[np.array([[1,2,3]]),0,0,0,np.array([[4,5,6]])]
輸出:
array([[1, 2, 3, 0, 0, 0, 4, 5, 6]])
詳細(xì)使用請(qǐng)查詢(xún)以下函數(shù):
hstack, vstack, column_stack, concatenate, c_, r_
7. 將較大的多維數(shù)組分割成較小的多維數(shù)組
a = np.floor(10*np.random.random((2,12)))
輸出:
array([[ 9., 7., 9., ..., 3., 2., 4.],
[ 5., 3., 3., ..., 9., 7., 7.]])
np.hsplit(a,3)
輸出:
[array([[ 9., 7., 9., 6.],
[ 5., 3., 3., 1.]]), array([[ 7., 2., 1., 6.],
[ 7., 5., 0., 2.]]), array([[ 9., 3., 2., 4.],
[ 3., 9., 7., 7.]])]
np.hsplit(a,(3,4))
輸出:
[array([[ 9., 7., 9.],
[ 5., 3., 3.]]), array([[ 6.],
[ 1.]]), array([[ 7., 2., 1., ..., 3., 2., 4.],
[ 7., 5., 0., ..., 9., 7., 7.]])]
實(shí)現(xiàn)類(lèi)似功能的函數(shù)包括:
hsplit,vsplit,array_split
8. 多維數(shù)組的復(fù)制操作
a = np.arange(12)
輸出:
array([ 0, 1, 2, ..., 9, 10, 11])
not copy at all
b = a
b is a # True
b.shape = 3,4
a.shape # (3L,4L)
def f(x) # Python passes mutable objects as references, so function calls make no copy.
print(id(x)) # id是python對(duì)象的唯一標(biāo)識(shí)符
id(a) # 111833936L
id(b) # 111833936L
f(a) # 111833936L
淺復(fù)制
c = a.view()
c is a # False
c.base is a # True
c.flags.owndata # False
c.shape = 2,6
a.shape # (3L,4L)
c[0,4] = 1234
print(a)
輸出:
array([[ 0, 1, 2, 3],
[1234, 5, 6, 7],
[ 8, 9, 10, 11]])
s = a[:,1:3]
s[:] = 10
print(a)
輸出:
array([[ 0, 10, 10, 3],
[1234, 10, 10, 7],
[ 8, 10, 10, 11]])
深復(fù)制
d = a.copy()
d is a # False
d.base is a # False
d[0,0] = 9999
print(a)
輸出:
array([[ 0, 10, 10, 3],
[1234, 10, 10, 7],
[ 8, 10, 10, 11]])
numpy基本函數(shù)和方法一覽
arange, array, copy, empty, empty_like, eye, fromfile, fromfunction, identity, linspace, logspace, mgrid, ogrid, ones, ones_like, r, zeros,zeros_like
Conversions
ndarray.astype, atleast_1d, atleast_2d, atleast_3d, mat
Manipulations
array_split, column_stack, concatenate, diagonal, dsplit, dstack, hsplit, hstack, ndarray.item, newaxis, ravel, repeat, reshape, resize,squeeze, swapaxes, take, transpose, vsplit, vstack
Questionsall, any, nonzero, where
Ordering
argmax, argmin, argsort, max, min, ptp, searchsorted, sort
Operations
choose, compress, cumprod, cumsum, inner, ndarray.fill, imag, prod, put, putmask, real, sum
Basic Statistics
cov, mean, std, var
Basic Linear Algebra
cross, dot, outer, linalg.svd, vdot
完整的函數(shù)和方法一覽表鏈接:
9. 特殊的索引技巧
a = np.arange(12)**2
輸出:
array([ 0, 1, 4, ..., 81, 100, 121])
i = np.array([1,1,3,8,5])
a[i]
輸出:
array([ 1, 1, 9, 64, 25])
j = np.array([[3,4],[9,7]])
a[j]
輸出:
array([[ 9, 16],
[81, 49]])
palette = np.array([[0,0,0],[255,0,0],[0,255,0],[0,0,255],[255,255,255]])
image = np.array([[0,1,2,0],[0,3,4,0]])
palette[image]
輸出:
array([[[ 0, 0, 0],
[255, 0, 0],
[ 0, 255, 0],
[ 0, 0, 0]],
[[ 0, 0, 0],
[ 0, 0, 255],
[255, 255, 255],
[ 0, 0, 0]]])
i = np.array([[0,1],[1,2]])
j = np.array([[2,1],[3,3]])
a[i,j]
輸出:
array([[ 2, 5],
[ 7, 11]])
l = [i,j]
a[l]
輸出:
array([[ 2, 5],
[ 7, 11]])
a[i,2]
輸出:
array([[ 2, 6],
[ 6, 10]])
a[:,j]
輸出:
array([[[ 2, 1],
[ 3, 3]],
[[ 6, 5],
[ 7, 7]],
[[10, 9],
[11, 11]]])
s = np.array([i,j])
print(s)
array([[[0, 1],
[1, 2]],
[[2, 1],
[3, 3]]])
a[tuple(s)]
輸出:
array([[ 2, 5],
[ 7, 11]])
print(tupe(s))
輸出:
(array([[0, 1],
[1, 2]]), array([[2, 1],
[3, 3]]))
10. 尋找最大值/最小值及其對(duì)應(yīng)索引值
time = np.linspace(20, 145, 5)
輸出:
array([ 20. , 51.25, 82.5 , 113.75, 145. ])
data = np.sin(np.arange(20)).reshape(5,4)
輸出:
array([[ 0. , 0.84147098, 0.90929743, 0.14112001],
[-0.7568025 , -0.95892427, -0.2794155 , 0.6569866 ],
[ 0.98935825, 0.41211849, -0.54402111, -0.99999021],
[-0.53657292, 0.42016704, 0.99060736, 0.65028784],
[-0.28790332, -0.96139749, -0.75098725, 0.14987721]])
ind = data.argmax(axis=0)
輸出:
array([2, 0, 3, 1], dtype=int64)
time_max = time[ind]
輸出:
array([ 82.5 , 20. , 113.75, 51.25])
data_max = data[ind, xrange(data.shape[1])]
輸出:
array([ 0.98935825, 0.84147098, 0.99060736, 0.6569866 ])
np.all(data_max == data.max(axis=0))
輸出:
True
a = np.arange(5)
a[[1,3,4]] = 0
print(a)
輸出:
array([0, 0, 2, 0, 0])
a = np.arange(5)
a[[0,0,2]] = [1,2,3]
print(a)
輸出:
array([2, 1, 3, 3, 4])
a = np.arange(5)
a[[0,0,2]] += 1
print(a)
輸出:
array([1, 1, 3, 3, 4])
a = np.arange(12).reshape(3,4)
b = a > 4
輸出:
array([[False, False, False, False],
[False, True, True, True],
[ True, True, True, True]], dtype=bool)
a[b]
輸出:
array([ 5, 6, 7, 8, 9, 10, 11])
a[b] = 0
print(a)
輸出:
array([[0, 1, 2, 3],
[4, 0, 0, 0],
[0, 0, 0, 0]])
a = np.arange(12).reshape(3,4)
b1 = np.array([False,True,True])
b2 = n.array([True,False,True,False])
a[b1,:]
輸出:
array([[ 4, 5, 6, 7],
[ 8, 9, 10, 11]])
a[b1]
輸出:
array([[ 4, 5, 6, 7],
[ 8, 9, 10, 11]])
a[:,b2]
輸出:
array([[ 0, 2],
[ 4, 6],
[ 8, 10]])
a[b1,b2]
輸出:
array([ 4, 10])
11. ix_() function
a = np.array([2,3,4,5])
b = np.array([8,5,4])
c = np.array([5,4,6,8,3])
ax,bx,cx = np.ix_(a,b,c)
print(ax) # (4L, 1L, 1L)
輸出:
array([[[2]],
[[3]],
[[4]],
[[5]]])
print(bx) # (1L, 3L, 1L)
輸出:
array([[[8],
[5],
[4]]])
print(cx) # (1L, 1L, 5L)
輸出:
array([[[5, 4, 6, 8, 3]]])
result = ax + bx*cx
輸出:
array([[[42, 34, 50, 66, 26],
[27, 22, 32, 42, 17],
[22, 18, 26, 34, 14]],
[[43, 35, 51, 67, 27],
[28, 23, 33, 43, 18],
[23, 19, 27, 35, 15]],
[[44, 36, 52, 68, 28],
[29, 24, 34, 44, 19],
[24, 20, 28, 36, 16]],
[[45, 37, 53, 69, 29],
[30, 25, 35, 45, 20],
[25, 21, 29, 37, 17]]])
result[3,2,4]
輸出:17
12. 線(xiàn)性代數(shù)運(yùn)算
a = np.array([[1.,2.],[3.,4.]])
a.transpose() # 轉(zhuǎn)置
np.linalg.inv(a) # 求逆
u = np.eye(2) # 產(chǎn)生單位矩陣
np.dot(a,a) # 矩陣乘積
np.trace(a) # 求矩陣的跡
y = np.array([5.],[7.]])
np.linalg.solve(a,y) # 求解線(xiàn)性方程組
np.linalg.eig(a) # 特征分解
“Automatic” Reshaping
a = np.arange(30)
a.shape = 2,-1,3
a.shape # (2L, 5L, 3L)
print(a)
array([[[ 0, 1, 2],
[ 3, 4, 5],
[ 6, 7, 8],
[ 9, 10, 11],
[12, 13, 14]],
[[15, 16, 17],
[18, 19, 20],
[21, 22, 23],
[24, 25, 26],
[27, 28, 29]]])
x = np.arange(0,10,2)
y = np.arange(5)
m = np.vstack([x,y])
輸出:
array([[0, 2, 4, 6, 8],
[0, 1, 2, 3, 4]])
n = np.hstack([x,y])
輸出:
array([0, 2, 4, 6, 8, 0, 1, 2, 3, 4])
13. 矩陣的創(chuàng)建
a = np.array([1,2,3])
a1 = np.mat(a)
輸出:
matrix([[1, 2, 3]])
type(a1)
輸出:
numpy.matrixlib.defmatrix.matrix
a1.shape
輸出:
(1L, 3L)
a.shape
輸出:
(3L,)
b=np.matrix([1,2,3])
輸出:
matrix([[1, 2, 3]])
from numpy import *
data1 = mat(zeros((3,3)))
data2 = mat(ones((2,4)))
data3 = mat(random.rand(2,2))
data4 = mat(random.randint(2,8,size=(2,5)))
data5 = mat(eye(2,2,dtype=int))
14. 常見(jiàn)的矩陣運(yùn)算
a1 = mat([1,2])
a2 = mat([[1],[2]])
a3 = a1 * a2
print(a3)
輸出:
matrix([[5]])
print(a1*2)
輸出:
matrix([[2, 4]])
a1 = mat(eye(2,2)*0.5)
print(a1.I)
輸出:
matrix([[ 2., 0.],
[ 0., 2.]])
a1 = mat([[1,2],[2,3],[4,2]])
a1.sum(axis=0)
輸出:
matrix([[7, 7]])
a1.sum(axis=1)
輸出:
matrix([[3],
[5],
[6]])
a1.max() # 求矩陣元素最大值
輸出:
4
a1.min() # 求矩陣元素最小值
輸出:
1
np.max(a1,0) # 求矩陣每列元素最大值
輸出:
matrix([[4, 3]])
np.max(a1,1) # 求矩陣每行元素最大值
輸出:
matrix([[2],
[3],
[4]])
a = mat(ones((2,2)))
b = mat(eye((2)))
c = hstack((a,b))
輸出:
matrix([[ 1., 1., 1., 0.],
[ 1., 1., 0., 1.]])
d = vstack((a,b))
輸出:
matrix([[ 1., 1.],
[ 1., 1.],
[ 1., 0.],
[ 0., 1.]])
15. 矩陣、數(shù)組、列表之間的互相轉(zhuǎn)換
aa = [[1,2],[3,4],[5,6]]
bb = array(aa)
cc = mat(bb)
cc.getA() # 矩陣轉(zhuǎn)換為數(shù)組
cc.tolist() # 矩陣轉(zhuǎn)換為列表
bb.tolist() # 數(shù)組轉(zhuǎn)換為列表
# 當(dāng)列表為一維時(shí),情況有點(diǎn)特殊
aa = [1,2,3,4]
bb = array(aa)
輸出:
array([1, 2, 3, 4])
cc = mat(bb)
輸出:
matrix([[1, 2, 3, 4]])
cc.tolist()
輸出:
[[1, 2, 3, 4]]
bb.tolist()
輸出:
[1, 2, 3, 4]
cc.tolist()[0]
輸出:
[1, 2, 3, 4]
數(shù)據(jù)分析咨詢(xún)請(qǐng)掃描二維碼
若不方便掃碼,搜微信號(hào):CDAshujufenxi
SQL Server 中 CONVERT 函數(shù)的日期轉(zhuǎn)換:從基礎(chǔ)用法到實(shí)戰(zhàn)優(yōu)化 在 SQL Server 的數(shù)據(jù)處理中,日期格式轉(zhuǎn)換是高頻需求 —— 無(wú)論 ...
2025-09-18MySQL 大表拆分與關(guān)聯(lián)查詢(xún)效率:打破 “拆分必慢” 的認(rèn)知誤區(qū) 在 MySQL 數(shù)據(jù)庫(kù)管理中,“大表” 始終是性能優(yōu)化繞不開(kāi)的話(huà)題。 ...
2025-09-18CDA 數(shù)據(jù)分析師:表結(jié)構(gòu)數(shù)據(jù) “獲取 - 加工 - 使用” 全流程的賦能者 表結(jié)構(gòu)數(shù)據(jù)(如數(shù)據(jù)庫(kù)表、Excel 表、CSV 文件)是企業(yè)數(shù)字 ...
2025-09-18DSGE 模型中的 Et:理性預(yù)期算子的內(nèi)涵、作用與應(yīng)用解析 動(dòng)態(tài)隨機(jī)一般均衡(Dynamic Stochastic General Equilibrium, DSGE)模 ...
2025-09-17Python 提取 TIF 中地名的完整指南 一、先明確:TIF 中的地名有哪兩種存在形式? 在開(kāi)始提取前,需先判斷 TIF 文件的類(lèi)型 —— ...
2025-09-17CDA 數(shù)據(jù)分析師:解鎖表結(jié)構(gòu)數(shù)據(jù)特征價(jià)值的專(zhuān)業(yè)核心 表結(jié)構(gòu)數(shù)據(jù)(以 “行 - 列” 規(guī)范存儲(chǔ)的結(jié)構(gòu)化數(shù)據(jù),如數(shù)據(jù)庫(kù)表、Excel 表、 ...
2025-09-17Excel 導(dǎo)入數(shù)據(jù)含缺失值?詳解 dropna 函數(shù)的功能與實(shí)戰(zhàn)應(yīng)用 在用 Python(如 pandas 庫(kù))處理 Excel 數(shù)據(jù)時(shí),“缺失值” 是高頻 ...
2025-09-16深入解析卡方檢驗(yàn)與 t 檢驗(yàn):差異、適用場(chǎng)景與實(shí)踐應(yīng)用 在數(shù)據(jù)分析與統(tǒng)計(jì)學(xué)領(lǐng)域,假設(shè)檢驗(yàn)是驗(yàn)證研究假設(shè)、判斷數(shù)據(jù)差異是否 “ ...
2025-09-16CDA 數(shù)據(jù)分析師:掌控表格結(jié)構(gòu)數(shù)據(jù)全功能周期的專(zhuān)業(yè)操盤(pán)手 表格結(jié)構(gòu)數(shù)據(jù)(以 “行 - 列” 存儲(chǔ)的結(jié)構(gòu)化數(shù)據(jù),如 Excel 表、數(shù)據(jù) ...
2025-09-16MySQL 執(zhí)行計(jì)劃中 rows 數(shù)量的準(zhǔn)確性解析:原理、影響因素與優(yōu)化 在 MySQL SQL 調(diào)優(yōu)中,EXPLAIN執(zhí)行計(jì)劃是核心工具,而其中的row ...
2025-09-15解析 Python 中 Response 對(duì)象的 text 與 content:區(qū)別、場(chǎng)景與實(shí)踐指南 在 Python 進(jìn)行 HTTP 網(wǎng)絡(luò)請(qǐng)求開(kāi)發(fā)時(shí)(如使用requests ...
2025-09-15CDA 數(shù)據(jù)分析師:激活表格結(jié)構(gòu)數(shù)據(jù)價(jià)值的核心操盤(pán)手 表格結(jié)構(gòu)數(shù)據(jù)(如 Excel 表格、數(shù)據(jù)庫(kù)表)是企業(yè)最基礎(chǔ)、最核心的數(shù)據(jù)形態(tài) ...
2025-09-15Python HTTP 請(qǐng)求工具對(duì)比:urllib.request 與 requests 的核心差異與選擇指南 在 Python 處理 HTTP 請(qǐng)求(如接口調(diào)用、數(shù)據(jù)爬取 ...
2025-09-12解決 pd.read_csv 讀取長(zhǎng)浮點(diǎn)數(shù)據(jù)的科學(xué)計(jì)數(shù)法問(wèn)題 為幫助 Python 數(shù)據(jù)從業(yè)者解決pd.read_csv讀取長(zhǎng)浮點(diǎn)數(shù)據(jù)時(shí)的科學(xué)計(jì)數(shù)法問(wèn)題 ...
2025-09-12CDA 數(shù)據(jù)分析師:業(yè)務(wù)數(shù)據(jù)分析步驟的落地者與價(jià)值優(yōu)化者 業(yè)務(wù)數(shù)據(jù)分析是企業(yè)解決日常運(yùn)營(yíng)問(wèn)題、提升執(zhí)行效率的核心手段,其價(jià)值 ...
2025-09-12用 SQL 驗(yàn)證業(yè)務(wù)邏輯:從規(guī)則拆解到數(shù)據(jù)把關(guān)的實(shí)戰(zhàn)指南 在業(yè)務(wù)系統(tǒng)落地過(guò)程中,“業(yè)務(wù)邏輯” 是連接 “需求設(shè)計(jì)” 與 “用戶(hù)體驗(yàn) ...
2025-09-11塔吉特百貨孕婦營(yíng)銷(xiāo)案例:數(shù)據(jù)驅(qū)動(dòng)下的精準(zhǔn)零售革命與啟示 在零售行業(yè) “流量紅利見(jiàn)頂” 的當(dāng)下,精準(zhǔn)營(yíng)銷(xiāo)成為企業(yè)突圍的核心方 ...
2025-09-11CDA 數(shù)據(jù)分析師與戰(zhàn)略 / 業(yè)務(wù)數(shù)據(jù)分析:概念辨析與協(xié)同價(jià)值 在數(shù)據(jù)驅(qū)動(dòng)決策的體系中,“戰(zhàn)略數(shù)據(jù)分析”“業(yè)務(wù)數(shù)據(jù)分析” 是企業(yè) ...
2025-09-11Excel 數(shù)據(jù)聚類(lèi)分析:從操作實(shí)踐到業(yè)務(wù)價(jià)值挖掘 在數(shù)據(jù)分析場(chǎng)景中,聚類(lèi)分析作為 “無(wú)監(jiān)督分組” 的核心工具,能從雜亂數(shù)據(jù)中挖 ...
2025-09-10統(tǒng)計(jì)模型的核心目的:從數(shù)據(jù)解讀到?jīng)Q策支撐的價(jià)值導(dǎo)向 統(tǒng)計(jì)模型作為數(shù)據(jù)分析的核心工具,并非簡(jiǎn)單的 “公式堆砌”,而是圍繞特定 ...
2025-09-10