df.div 除法


可實現除法

函數參數

DataFrame.div(other, axis='columns', level=None, fill_value=None)

參數

other:標量,序列,系列或DataFrame

axis:{0 or ‘index’, 1 or ‘columns’},也就是按行除還是按列除

level:int or label,

fill_value:float or None, default None,補充缺失值

例子

df = pd.DataFrame({'angles': [0, 3, 4],
                   'degrees': [360, 180, 360]},
                  index=['circle', 'triangle', 'rectangle'])
           angles  degrees
circle 0 360 triangle 3 180 rectangle 4 360

具體看參考官網:https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.div.html?highlight=div#pandas.DataFrame.div

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM