Skip to content
Advertisement

Updating values within python column based on date

I have a dataset where I would like to replace and update values within a column when a data condition is met.

Data

JavaScript

Desired

JavaScript

Doing

JavaScript

Still researching, any suggestion is appreciated- Perhaps I need to convert quarters to datetime longdate and base the condition off of this column.

Advertisement

Answer

here is one way to do it

to apply the condition, Date need to be in Year and Quarter, and then applying np.where condition. However, you need to put the condition in the same format i.e. YYQ (year, quarter)

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