Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Bug BBQ: Call to `reset_index` in merging lesson not needed?

未关闭
#224 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
data

调研方向

从 04-merging-data 中关于合并的课程开始,检查其中展示的 survey_sub 和 survey_sub_last10 拼接示例。比较使用和不使用 reset_index(drop=True) 时的结果,包括最终的索引值,并查看 issue 讨论。完成的标准是课程中的指示和说明准确描述所需的行为。

由索引模型根据 Issue 内容生成。

描述

help wanted type:clarification

The merging lesson has the following code excerpt:

# read in first 10 lines of surveys table
survey_sub = surveys_df.head(10)
# grab the last 10 rows 
survey_sub_last10 = surveys_df.tail(10)
#reset the index values to the second dataframe appends properly
survey_sub_last10=survey_sub_last10.reset_index(drop=True)
# drop=True option avoids adding new index column with old index values

It's not really explained why reset_index needs to be called for the second frame to append "properly". I tried following along without resetting the index, and it seemed to do the right thing. Of course there's a big gap between the index values in the first and second half of the concatenated df, but that seems fine to me (and even preferable to having duplicate index values, which happens if you call reset_index).

I'm inclined to remove that line, but it's possible I'm missing something.

主要语言
Jupyter Notebook
星标
176
派生
316
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

datacarpentry/python-ecology-lesson 的其他 Issue

查看 datacarpentry/python-ecology-lesson 的全部 Issue

相似的 Issue

更多 Data Engineering Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。