pandas、numpy篇——索引、采样、函数

numpy :

np[begin:end:k]
np[row,column]=np[(row,column)]
row,column may be single inter or list or slice or boolean array

nd.take(index list),nd[list]
nd.put(index list,42)将42赋值给index


np.random.choice(array,size=2,p=[probability list]

np.where(condition,x,y)
condition boolean array

pandas:

df.column_name
df[slice] row slice 
df[df>0]返回df的subsequent,同df.where不同

df.loc[]
row name
row name list or slice
row name,column name
row name list or slice ,column name list or slice
boolean array or callable function,boolean array or callable function

df.iloc[]
inter
inter list or slice
inter list or slice,inter list or slice
boolean array ,boolean array

df.at
df.iat

df.sample(n=3,axis=0,replace=True,weights=example_weights_list,random_state=2)采样
series.isin([element list])返回Boolean array

df.where(condition,x)条件不成立时取x,返回shape同df
df1.where(conditon,df2)==np.where(condition,df1,df2)
df.query(condition str)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值