anuragpatibandla7

2014-10-14 15:57:56 UTC

I have a dictionary that looks like this:

{"1":{"Key1":"Value1", "Key2":"Value2", "Key3":"Value3"},

"2":{"Key1":"Value1", "Key2":"Value2", "Key3":"Value3"},

"3":{"Key1":"Value1", "Key2":"Value2", "Key3":"Value3"},

"4":{"Key1":"Value1", "Key2":"Value2", "Key3":"Value3"}}

Now if I have 100 objects like these and I need to split them into 3 smaller dicts in a ratio 2:3:5, how could I do that?

I tried using numpy.random.choice(), but it says it needs to be a 1-d array.

Can someone please help with this?

Thanks

{"1":{"Key1":"Value1", "Key2":"Value2", "Key3":"Value3"},

"2":{"Key1":"Value1", "Key2":"Value2", "Key3":"Value3"},

"3":{"Key1":"Value1", "Key2":"Value2", "Key3":"Value3"},

"4":{"Key1":"Value1", "Key2":"Value2", "Key3":"Value3"}}

Now if I have 100 objects like these and I need to split them into 3 smaller dicts in a ratio 2:3:5, how could I do that?

I tried using numpy.random.choice(), but it says it needs to be a 1-d array.

Can someone please help with this?

Thanks