Pandas DataFrame.cummin(~) 方法計算源 DataFrame 的行或列的累積最小值。
參數
1.axis | int 或 string | optional
是否計算每行或每列的累積最小值:
| 軸 | 說明 | 
|---|---|
| 
 | 計算每列的累積最小值。 | 
| 
 | 計算每行的累積最小值。 | 
默認情況下,axis=0 。
2. skipna | boolean | optional
是否忽略 NaN 。默認情況下,skipna=True 。
返回值
DataFrame 保存行或列值的累積最小值。
例子
考慮以下 DataFrame :
df = pd.DataFrame({"A":[3,2,4],"B":[7,6,2],"C":[3,5,6]})
df
   A  B  C
0  3  7  3
1  2  6  5
2  4  2  6每列的累計最小值
要計算每列的累積最小值:
df.cummin()
   A  B  C
0  3  7  3
1  2  6  3
2  2  2  3每行累計最小值
要計算每行的累積最小值:
df.cummin(axis=1)
   A  B  C
0  3  3  3
1  2  2  2
2  4  2  2處理缺失值
考慮以下帶有缺失值的DataFrame:
df = pd.DataFrame({"A":[3,pd.np.nan,5]})
df
   A
0  3.0
1  NaN
2  5.0默認情況下, skipna=True ,這意味著忽略缺失值:
df.cummin()   # skipna=True
   A
0  3.0
1  NaN
2  3.0考慮缺失值:
df.cummin(skipna=False)
   A
0  3.0
1  NaN
2  NaN在這裏,請注意我們如何在第一個 NaN 之後得到 NaN 。
相關用法
- Python Pandas DataFrame cummax方法用法及代碼示例
- Python Pandas DataFrame cumprod方法用法及代碼示例
- Python Pandas DataFrame cumsum方法用法及代碼示例
- Python Pandas DataFrame copy方法用法及代碼示例
- Python PySpark DataFrame collect方法用法及代碼示例
- Python PySpark DataFrame coalesce方法用法及代碼示例
- Python Pandas DataFrame clip方法用法及代碼示例
- Python Pandas DataFrame corrwith方法用法及代碼示例
- Python PySpark DataFrame corr方法用法及代碼示例
- Python Pandas DataFrame convert_dtypes方法用法及代碼示例
- Python Pandas DataFrame combine方法用法及代碼示例
- Python Pandas DataFrame columns屬性用法及代碼示例
- Python PySpark DataFrame cov方法用法及代碼示例
- Python Pandas DataFrame count方法用法及代碼示例
- Python PySpark DataFrame colRegex方法用法及代碼示例
- Python PySpark DataFrame columns屬性用法及代碼示例
- Python PySpark DataFrame count方法用法及代碼示例
- Python Pandas DataFrame corr方法用法及代碼示例
- Python Pandas DataFrame combine_first方法用法及代碼示例
- Python Pandas DataFrame cov方法用法及代碼示例
- Python Pandas DataFrame empty屬性用法及代碼示例
- Python Pandas DataFrame pop方法用法及代碼示例
- Python Pandas DataFrame nsmallest方法用法及代碼示例
- Python Pandas DataFrame sample方法用法及代碼示例
- Python Pandas DataFrame items方法用法及代碼示例
注:本文由純淨天空篩選整理自Isshin Inada大神的英文原創作品 Pandas DataFrame | cummin method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
