【问题标题】:How to iterate over selected rows in pandas如何遍历熊猫中的选定行
【发布时间】:2021-01-06 00:41:56
【问题描述】:

我需要在 pandas 数据框中迭代一些选定的行。我尝试了“for index, row in df.iterrows()”来遍历所有行。如何选择要迭代的行?说第 50-100 行?

【问题讨论】:

    标签: pandas


    【解决方案1】:

    你可以这样做:

    for index, row in df.iloc[50:100].iterrows()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-11
      • 1970-01-01
      • 2023-01-10
      • 2021-12-18
      • 1970-01-01
      • 2023-03-24
      • 2014-09-08
      • 1970-01-01
      相关资源
      最近更新 更多