pandas 中的DataFrame.div和DataFrame.divide之间的区别 [英] Difference between DataFrame.div and DataFrame.divide in pandas
问题描述
我正在尝试将熊猫数据框的一列元素与另一列的相同行索引元素分开.在尝试找到库函数来实现此目的时,我遇到了两个函数 DataFrame .divide .它们的文档非常相似,我想知道它们之间可能有什么区别.它们之间有什么区别吗?它们的内部实现方式不同吗?如果是,怎么办?预先感谢.
I am trying to divide elements of a one column of pandas data frame with same row index elements of another column. While trying to find library functions to achieve this, I came across two functions DataFrame.div and DataFrame.divide. Their documentations are very similar and I am wondering what the differences between them might be. Are there any differences between them? Is their internal implementation different? If yes, how so? Thanks in advance.
推荐答案
They are both aliases for the function pd.DataFrame.truediv
, and they all do the same thing - perform index-aligned division along the given axis.
truediv
是pandas/core/ops.py中的"noreferrer> _op_descriptions
数据结构.后来创建div
和divide
作为对此的引用.
truediv
is one of the main operations specified in the _op_descriptions
data-structure in pandas/core/ops.py
. div
and divide
are later created as references to this.
这篇关于 pandas 中的DataFrame.div和DataFrame.divide之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!