I have a pandas dataframe and I want to iterate over rows of this dataframe, get slices of data, based on a value in a column.
To say it more brief, I have a dataframe like below:
districts = [['dist','name','sale','purchase'],['dis1','avelin',2300, 1400],['dis2','matri', 4300, 2500], ['dis1', 'texi', 1500, 1700],['dis2','timi', 2300, 1400]]
I'd like to iterate over all rows and extract dataframes based on 'dist' column.
the output should look like below:
dis1 = [[2300, 1400], [1500,1700]]
dis2 = [[4300,2500],[2300,1400]]