I am running a loop to slice table based on value of a given dictionary. But I would like to create one table for each loop and save table using the key of the dictionary. In the following example, I would like put the 'key' in table name df_slice, such as df_slice_loc1, df_slice_loc2
import numpy as np
import pandas as pd
df = pd.DataFrame({'group': ['A', 'B', 'C', 'D', 'E']
,'scoreA': np.random.randn(5)
,'scoreB': np.random.randn(5)})
loc_d = {"loc1":2, "loc2":3}
for key, value in loc_d.items():
df_slice = df.iloc[:value,]