I have a dataframe as follows:
>>> import pandas as pd >>> import numpy as np >>> df = pd.DataFrame({\'key1\' : [\'a\',\'a\',\'b\',\'b\