Here is working code
import pandas as pd full_df = pd.DataFrame({ "a": [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, ] }) sub_df = pd.DataFr