【问题标题】:not able to append row in new dataframe [duplicate]无法在新数据框中追加行[重复]
【发布时间】:2019-11-07 08:47:13
【问题描述】:

****无法在新数据框中追加行** 任何努力都会得到认可**

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)

【问题讨论】:

  • usda 是什么?

标签: python pandas


【解决方案1】:

试试new_df=new_df.append(z,ignore_index = True)。否则新的数据框不会保存到变量new_df

【讨论】:

    猜你喜欢
    • 2018-11-05
    • 2017-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-21
    • 2018-06-26
    • 1970-01-01
    相关资源
    最近更新 更多