I am reading in data from an excel file. And currently I am breaking down it several different DFs based on the row numbers. What I want to do is create a loop which will iterate over the imputed row numbers and create different Dfs with the appropriate suffixes. Currently I am creating separate Dfs by passing in row numbers in each line.
NHE_17= NHE_data.parse('NHE17')
#Slice DataFrame for only Total National Health Expenditure data, from
row 0 to 37(Population): total_nhe
total_nhe = NHE_17.iloc[0:37]
print(total_nhe.iloc[0,-1])
#Slice DataFrame for only Health Consumption Expenditures, from row 38 to
70(Total CMS Programs (Medicaid, CHIP and Medicare): total_hce
total_hce = NHE_17.iloc[38:70]
I want to be able call the function with the row numbers and suffix to create the specific DF.