用法:
Series.pipe(func, *args, **kwargs)應用需要 Series 或 DataFrames 的可鏈接函數。
- func:函數
應用於 Series/DataFrame 的函數。
args和kwargs被傳遞到func。或者(callable, data_keyword)元組,其中data_keyword是一個字符串,指示需要 Series/DataFrame 的callable的關鍵字。- args:可迭代的,可選的
傳遞給
func的位置參數。- kwargs:映射,可選
傳遞給
func的關鍵字參數字典。
- object:
func的返回類型。
- object:
參數:
返回:
注意:
將需要 Series、DataFrames 或 GroupBy 對象的函數鏈接在一起時,請使用
.pipe。而不是寫>>> func(g(h(df), arg1=a), arg2=b, arg3=c)你可以寫
>>> (df.pipe(h) ... .pipe(g, arg1=a) ... .pipe(func, arg2=b, arg3=c) ... )如果您有一個將數據作為(例如)第二個參數的函數,請傳遞一個元組,指示哪個關鍵字需要數據。例如,假設
f將其數據作為arg2:>>> (df.pipe(h) ... .pipe(g, arg1=a) ... .pipe((func, 'arg2'), arg1=a, arg3=c) ... )
相關用法
- Python pandas.Series.plot.line用法及代碼示例
- Python pandas.Series.plot.hist用法及代碼示例
- Python pandas.Series.plot.box用法及代碼示例
- Python pandas.Series.pop用法及代碼示例
- Python pandas.Series.pow用法及代碼示例
- Python pandas.Series.product用法及代碼示例
- Python pandas.Series.plot.kde用法及代碼示例
- Python pandas.Series.plot.pie用法及代碼示例
- Python pandas.Series.plot.bar用法及代碼示例
- Python pandas.Series.pct_change用法及代碼示例
- Python pandas.Series.plot.area用法及代碼示例
- Python pandas.Series.plot.barh用法及代碼示例
- Python pandas.Series.plot.density用法及代碼示例
- Python pandas.Series.prod用法及代碼示例
- Python pandas.Series.add_prefix用法及代碼示例
- Python pandas.Series.map用法及代碼示例
- Python pandas.Series.max用法及代碼示例
- Python pandas.Series.str.isdecimal用法及代碼示例
- Python pandas.Series.str.get用法及代碼示例
- Python pandas.Series.to_csv用法及代碼示例
注:本文由純淨天空篩選整理自pandas.pydata.org大神的英文原創作品 pandas.Series.pipe。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
