Given this sample dataframe:
#%% import pandas as pd import numpy as np #%% df = pd.DataFrame({\'dev_id\': [\'A1\',\'A1\',\'A1\',\'A1\',\'A1\',\'A2\',\'A2\',