0

I have created two data frames called 'Exmil_df' and `'Schedule_df'. I need to iterate over all the elements inside the data frame.I am using the below code.

    i=0
    j=0
    Schedule_df['Allocation']=0
    while i < len(Exmil_df):
        while j < len(Schedule_df):
            while (Schedule_df[Schedule_df['Requirement']]>=Schedule_df[Schedule_df['Allocation']]):
                print('*')

But it's giving KeyError: "None of [Int64Index([32000, 12000], dtype='int64')] are in the [columns]". Can't I access elements inside the loop in this way?

jithmi97
  • 19
  • 8
  • Does this answer your question? [How to iterate over rows in a DataFrame in Pandas](https://stackoverflow.com/questions/16476924/how-to-iterate-over-rows-in-a-dataframe-in-pandas) – Shivam Roy May 10 '21 at 09:58
  • This works for 'for loop'. But in while loop its different – jithmi97 May 10 '21 at 10:04

0 Answers0