mardi 12 mars 2019

Pandas: Randomly splitting index values between 2 index values

This is an "ISO week 53 problem".

I have a pandas Series instance with index values representing the ISO week number:

import pandas as pd
ts = pd.Series([1,1,1,2,3,1,2], index=[1,1,2,2,52,53,53])

I want to remove and randomly add all of the values for index = 53 equally between index = 1 and index = 52. How do I do this, please?

Thanks for any help.




Aucun commentaire:

Enregistrer un commentaire