Bug BBQ: Call to `reset_index` in merging lesson not needed?
还没有人认领这个 Issue。
评估
调研方向
从 04-merging-data 中关于合并的课程开始,检查其中展示的 survey_sub 和 survey_sub_last10 拼接示例。比较使用和不使用 reset_index(drop=True) 时的结果,包括最终的索引值,并查看 issue 讨论。完成的标准是课程中的指示和说明准确描述所需的行为。
由索引模型根据 Issue 内容生成。
描述
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 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
datacarpentry/python-ecology-lesson 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 1/5 1-3 小时 新手友好度 78/100
-
Error in solution to "Challenge - Plots"可能已有人在做 @archaeolauren 于 190 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
-
Recommend a supported Python release, not just any 3.x可能已有人在做 @nbdani 于 192 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 75/100
-
难度 1/5 1 小时以内 新手友好度 65/100
查看 datacarpentry/python-ecology-lesson 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 67/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 64/100
xqlsystems/xarray-sql#267 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
NeuroTechX/moabb#1307 ·
维护者通常 1 天内回复
-
new-spider
难度 2/5 1-3 小时 新手友好度 75/100
alltheplaces/alltheplaces#19833 ·
维护者通常 1 天内回复
-
bug good first issue hacktoberfest
难度 2/5 1-3 小时 新手友好度 84/100
useagenthq/useagent#246 ·
维护者通常 1 天内回复