I convert dictionary to pandas DataFrame
import pandas as pd my_dict = { 0: {1,5,8}, 1: {2,7,6}, 2: {8,3,7} } df = pd.DataFrame.from_dict(my_dict, orient=\'in