pandas的一些应用

1.DataFrame.sub(otheraxis='columns'level=Nonefill_value=None)(dataframe相减)

Subtraction of dataframe and other, element-wise (binary operator sub).

Equivalent to dataframe - other, but with support to substitute a fill_value for missing data in one of the inputs.


2.DataFrame.apply(funcaxis=0broadcast=Falseraw=Falsereduce=Noneargs=()**kwds)

Applies function along input axis of DataFrame.

Objects passed to functions are Series objects having index either the DataFrame’s index (axis=0) or the columns (axis=1). 

Return type depends on whether passed function aggregates, or the reduce argument if the DataFrame is empty.





3.DataFrame.sort_index(axis=0by=Noneascending=Trueinplace=Falsekind='quicksort')

Sort DataFrame either by labels (along either axis) or by the values in a column


4.DataFrame.sort_values(byaxis=0ascending=Trueinplace=Falsekind='quicksort'na_position='last') Sort by the values along either axis


5.DataFrame.cumsum(axis=Nonedtype=Noneout=Noneskipna=True**kwargs)

Return cumulative sum over requested axis.


6.DataFrame.dropna(axis=0how='any'thresh=Nonesubset=Noneinplace=False) Return object with labels on given axis omitted where alternately any or all of the data are missing


7.DataFrame.map





Like values in a Series, axis labels can be similarly transformed by a function or mapping of some form to produce new, differently labeled objects. You can also modify the axes in-place without creating a new data structure. Here’s a simple example:


7.DataFrame.sample(n=Nonefrac=Nonereplace=Falseweights=Nonerandom_state=Noneaxis=None)     Returns a random sample of items from an axis of object.


8. dummy variables




这里用df[['data1']].join(dummies)相当于直接删除了key这一列,把想要的直接加在后面了。

9.多维DataFrame的拆解





10.DataFrame. join ( otheron=Nonehow='left'lsuffix=''rsuffix=''sort=False ) Join columns with other DataFrame either on index or on a key column. Efficiently Join multiple DataFrame objects by index at once by passing a list.


11.groupby中使用函数





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值