I have a dataframe with potentially millions of rows like the following:
df:
name value
1 bob1 abc
2 bob3 def
3 jake2 ghi
4 jake jkl
5 sam1 mno
6 bob5 pqr
How can I split this into multiple dataframes based on the name column values containing some substring, such as 'bob', 'jake', and 'sam' in this example?
The new dataframes can be still kept in one data structure such as a dictionary if this changes anything.
Desired dataframes:
df1:
name value
1 bob1 abc
2 bob3 def
3 bob5 pqr
df2:
name value
1 jake2 ghi
2 jake jkl
df3:
name value
1 sam1 mno