Status
Not started
Element-wise math, matrix dot products, and value-wise comparison.
Arithmetic
df.add()
ordf.__add__
→ Add element-wise; supports fill_value.df.sub()
ordf.__sub__
→ Subtract element-wise.df.mul()
ordf.__mul__
→ Multiply element-wise.df.div()
ordf.truediv()
→ Divide element-wise (true division).df.floordiv()
→ Floor division.df.mod()
→ Modulo.df.pow()
→ Exponentiate.df.dot()
→ Matrix multiplication.df.radd()
,df.rsub()
,df.rmul()
,df.rdiv()
,df.rtruediv()
,df.rfloordiv()
,df.rmod()
,df.rpow()
→ Reverse operations.
Comparison
df.lt()
→ Element-wise less than.df.gt()
→ Greater than.df.le()
→ Less than or equal.df.ge()
→ Greater than or equal.df.eq()
→ Equal to.df.ne()
→ Not equal to.
Combine
df.combine(other, func)
→ Combine two DataFrames element-wise using a function.df.combine_first(other)
→ Fill missing values withother
.
Math, Binary Operations & Comparison in Pandas DataFrames
⚠️ Vectorization Principle
Pandas operations are designed to work on entire arrays at once. These methods leverage NumPy's vectorized operations, making them dramatically faster than Python loops.
‣
Arithmetic Operations
‣
Comparison Operations
‣
Combine Operations
‣
Performance Optimization Strategies
‣