Jun-22-2021, 07:22 AM
Hi,
I have a data frame that need to add empty line at the end of that. I also see from examples that it show NaN but I don't want that, I need it totally empty. I took and example code below that adds 3 empty lines with "NaN". What I want is only one empty row at the end of the list without "NaN".
I have a data frame that need to add empty line at the end of that. I also see from examples that it show NaN but I don't want that, I need it totally empty. I took and example code below that adds 3 empty lines with "NaN". What I want is only one empty row at the end of the list without "NaN".
import pandas as pd df_new = pd.DataFrame([]) items = pd.DataFrame([ ["Item Type","Item Name","Price AED"], ["laptops", "HP", 2400], ["laptops", "DELL", 3400], ["laptops", "ACER", 1400] ]) for i, row in items.iterrows(): df_new = df_new.append(row) for _ in range(3): df_new = df_new.append(pd.Series(), ignore_index=True) print(df_new)