How to deal with zeros when calculating percentage changes is a challenge for the researcher and requires some domain expertise. If the researcher believes that he will not distort the data, he can simply add a very small constant to all the values ββto get rid of all zeros. For example, in financial series, when it comes to trading volume, we cannot do this, because trading volume = 0 means that: the asset was not traded at all. The value volume = 0 can be very different from volume = 0.00000000001. This is my preferred strategy in cases where I cannot logically add a small constant to all values. Consider the percentage change formula ((New-Old) / Old) * 100. If New = 0, then the percentage change will be -100%. This number really makes financial sense, as long as it is the minimum percentage change in the series (this is really guaranteed as the minimum percentage change in the series). What for? Because it shows that the volume of trade is experiencing the maximum possible decline, which goes from any number to 0, -100%. So, I will be fine with this value, which is in my series of percent changes. If I normalize this series, itβs even better, since this (possibly) relatively large number in absolute value will be analyzed on the same scale as other variables. Now, what if Old value = 0. This is a more complicated case. A change in percentage due to a transition from 0 to 1 will be equal to that due to a transition from 0 to a million: infinity. The fact that we call the percent change of "infinity" is problematic. In this case, I would set the infinities to np.nan and interpolate them.
The following graph shows what I discussed above. Starting with series 1, we get row 4, which is ready for analysis without INF or NaN.

One more thing: a lot of time, the reason for calculating the percentage change is to station the data. So, if your original series contains zero, and you want to convert it to a percentage change to achieve stationarity, first make sure it is not already installed. Because, if so, you do not need to calculate the percentage change. The fact is that the series that take the value of 0 a lot (OP problem) are likely to be stationary already, for example, the series of volumes discussed above. Imagine a cross section oscillating above and below zero, thus hitting 0 at times. Such a series is very likely already stationary.
Saeed source share