Thanks @alveera.khn
Also, if you want to append rows repeatedly but efficiently, avoid append()
in a loop. Instead, build a list of dictionaries or DataFrames
and concatenate at the end:
rows = []
rows.append({'lib': 'A', 'qty1': 10, 'qty2': 20})
rows.append({'lib': 'B', 'qty1': 5, 'qty2': 15})
df = pd.concat([df, pd.DataFrame(rows)], ignore_index=True)
This balances convenience and performance, especially when dealing with many rows.