Skip to content
Advertisement

How to perform row wise if and mathematical operations in pandas dataframe

Input Data:

JavaScript

So basically want to check if first row amount (5000.00) is equal to second row amount; then perform a date difference function (13-02-2019 “-” 12-02-2019) and if difference is less than “5 days” then the following is the output. If difference is more than 5 days exclude from the output (Line number 4)

JavaScript

Advertisement

Answer

You can shift the date to calculate the time delta between the rows. After I filter for the conditions you defined.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement