-2

****Not able to append row in new Data Frame** Any affort would be appriciated**

new_df=pd.DataFrame()

z=pd.DataFrame()

x=input("input number")
x=int(x)
for i in range(x):
    y=input("enter srting")
    z=usda[usda.Description.str.contains("y")]

    new_df.append(z,ignore_index = True)
print(new_df)
Amit
  • 327
  • 2
  • 11

1 Answers1

0

Try new_df=new_df.append(z,ignore_index = True). Otherwise the new dataframe is not saved to the variable new_df.

charlzee
  • 26
  • 2