'pandas: compute % change between 2 columns, without rounding
I want to compute the percentage change in value between 2 columns like below
df['change' ] =100*(df[df.columns[1]]-df[df.columns[0]])/df[df.columns[0]]
However I noted when the change values are very small like 0.001, Python round them to 0.
I want the exact values. Thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
