I have a data-frame which looks similar to this (has about 300k rows):
df = DataFrame(dict(name = ['jon', 'jon', 'dany', 'dany', 'mindy', 'mindy', 'mindy'],
power = [1, 2, 2 ,4 ,5 ,5, 7],
rank = ['a', 'b', 'c', 'd', 'r', 'a', 'g']))
which gives this :
what I want is a list of data-frames(subset) like this:
df_list = [df_1, df_2, df_3]
where df_1, df_2, df_3 are essentially these:
df_1 = df.query("name == 'jon'")
df_2 = df.query("name == 'dany'")
df_3 = df.query("name == 'mindy'")
In the dataset that I'm working with, there are about 500+ names
. So how do I efficiently do this?