if data is a dataframe, data.to_dict() should work, as demonstrated below:
import pandas as pd
data_3 = {
'YEAR':[ '1988-1994', '1999-2002', '2001-2004', '2003-2006', '2005-2008','2007-2010', '2009-2012', '2011-2014', '2013-2016', '2015-2018'],
'Normal_weight': [41.6, 33, 32.3, 31.6, 30.8, 29.8, 29.6, 28.9, 27.7, 26],
'Overweight_or_obese': [56, 65.1, 66, 66.7, 67.5, 68.5, 68.7, 69.5, 70.9, 72.5],
'Obesity': [22.9, 30.4, 31.4, 33.4, 34, 34.7, 35.3, 36.4, 38.8, 41.1],
'Grade_1_obesity': [14.8, 17.9, 19.3, 19.8, 19.5, 19.9, 20.4, 20.6, 21.2, 22],
'Grade_2_obesity': [5.2, 7.6, 7.2, 8.2, 8.7, 8.9, 8.6, 8.8, 9.9, 10.5],
'Grade_3_obesity': [2.9, 4.9, 5, 5.4, 5.8, 6, 6.3, 6.9, 7.7, 8.6]
}
data = pd.DataFrame(data_3)
print(data.to_dict())
It is possible to create the dataframe you want from the existing data, but it’s hard to demonstrate without having access to an example dataframe.