0

This this code is suppose to create new df from the original. In sales there are material code and it creates a new df for every material code that are in partial_list. After that it goes through the original df and takes out and pastes the rows into the right dataframe with append(). Now that append is deprecated how do i change this to concat() and make it work the same?

# Create new dataframes
for code in partial_list:
    globals()['df_'+code] = pd.DataFrame(columns=sales.columns)

# Loop through the original dataframe and add the rows to the new dataframes
for i, row in sales.iterrows():
    if row['Material'] in partial_list:
        globals()['df_'+row['Material']] = globals()['df_'+row['Material']].append(row, ignore_index=True)
        sales = sales.drop(i)
Zqm
  • 11
  • 2

0 Answers0