import pandas as pd dataset = { 'sale_1':{ "ITEM_name": "chips", "category": "food", "quantity": "10", "price_per_unit": "30", "date": "12-10-2024", }, 'sale_2':{ "ITEM_name": "chips", "category": "food", "quantity": "10", "price_per_unit": "30", "date": "12-10-2024", }, 'sale_3':{ "ITEM_name": "chips", "category": "food", "quantity": "10", "price_per_unit": "30", "date": "12-10-2024", }, 'sale_4':{ "ITEM_name": "chips", "category": "food", "quantity": "10", "price_per_unit": "30", "date": "12-10-2024", }, 'sale_5':{ "ITEM_name": "chips", "category": "food", "quantity": "10", "price_per_unit": "30", "date": "12-10-2024", }, } df = pd.DataFrame.from_dict(dataset) df.to_csv('data.csv')