Skip to content
Advertisement

Pandas group by one column and repeat the values of another column

I was trying to divide the month into two weeks. Basically for each month i am trying to create week numbers like 1,2,3,4 and repeat them.

How to create the required column like below:

JavaScript

Advertisement

Answer

You can utilize cycle to create cycle for list and slice to get specific count

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