# I might have missed this but why is \`head(df::AbstractDataFrame)\` deprecated?

**URL:** <https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988>\
**Category:** Data\
**Created:** [August 26, 2019, 7:42am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988 "2019-08-26T07:42:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [August 26, 2019, 7:42am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/1 "2019-08-26T07:42:53Z")

</div>

`head` seems to be terminology used everywhere including R and Pandas, so why deprecate it?

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [August 26, 2019, 9:28am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/2 "2019-08-26T09:28:35Z")

</div>

Because Julia uses `first` for this.

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [August 26, 2019, 9:45am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/3 "2019-08-26T09:45:40Z")

</div>

Eh… Not really making sense. I think it is a joke. Why is first preferred. It used to use head that’s why it was “deprecated” otherwise there wouldn’t be anything to deprecate

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 26, 2019, 9:58am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/4 "2019-08-26T09:58:49Z")

</div>

It got changed from `head` to `first` because Julia uses `first` for this everywhere else (see the docstring for `first`).

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [August 26, 2019, 10:05am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/5 "2019-08-26T10:05:51Z")

</div>

Depends what “this” is. `first` gives the first element everywhere in the Julia ecosystem, and this gives the first row, but `head` gives the top 5 rows. `first(df, 5)` feels like a regression, given that this is constantly used for data analysis.

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [August 26, 2019, 10:07am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/6 "2019-08-26T10:07:44Z")

</div>

> [@mkborregaard](#):
>
> `first(df, 5)` feels like a regression

Roughly how I feel. I feel it’s more of an inconvenience than anything.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [August 26, 2019, 10:33am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/7 "2019-08-26T10:33:49Z")

</div>

Well, just define your own head(df) function in startup.jl .

---

<div class="post-metadata">

**Author:** ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Post date:** [August 26, 2019, 11:03am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/8 "2019-08-26T11:03:36Z")

</div>

The issue is that `first` and `last` take count argument for `AbstractStrings` only, not for general collections. Actually - as noted in [https://github.com/JuliaData/DataFrames.jl/pull/1932](https://github.com/JuliaData/DataFrames.jl/pull/1932) personally I would be OK to leave `head` and `tail`, but as noted in the comments above - this is just a convenience issue.

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [August 26, 2019, 11:14am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/9 "2019-08-26T11:14:08Z")

</div>

> [@bkamins](#):
>
> this is just a convenience issue

Yes, but convenience issues are nice for those of us who do a lot of data analysis in the console. I sometimes feel that design decisions in julia de-emphasize console convenience a little (e.g. the global scope debacle) and I do feel it’s a shame, especially in cases where the convenience is free (and non-breakingly consistent with previous use).

> [@ufechner7](#):
>
> Well, just define your own head(df) function in startup.jl .

I never felt this to be a good general advice for these situations - since defining convenience functions in your startup.jl file renders your code non-shareable.

---

<div class="post-metadata">

**Author:** ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Post date:** [August 26, 2019, 11:22am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/10 "2019-08-26T11:22:42Z")

</div>

> [@mkborregaard](#):
>
> Yes, but convenience issues are nice for those of us who do a lot of data analysis in the console.

This is exactly what I meant 😄 (that is why I also advocated to leave `nrow` and `ncol`). If you feel we should revert `head` and `tail` please comment in [Why not let `first(df)` have the same behaviour as `head(df)`? by xiaodaigh · Pull Request #1932 · JuliaData/DataFrames.jl · GitHub](https://github.com/JuliaData/DataFrames.jl/pull/1932) and I will reopen it for discussion.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [August 26, 2019, 11:27am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/11 "2019-08-26T11:27:39Z")

</div>

I think the issue here is more profound. Whenever a decision is made by package authors to deprecate a function name, it should be assessed first with the entire community of users, maybe a post on discourse? Without any attempt to consult the users, the community will feel ignored.

This has happened before with the Julia language itself, but happily no change so far has caused major complications downstream.

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [August 26, 2019, 11:37am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/12 "2019-08-26T11:37:34Z")

</div>

Yeah. Please don’t deprecate `head` `tail` `ncol` `nrow`.

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [August 26, 2019, 11:42am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/13 "2019-08-26T11:42:57Z")

</div>

> [@juliohm](#):
>
> Whenever a decision is made by package authors to deprecate a function name, it should be assessed first with the entire community of users, maybe a post on discourse?

That may be overdoing it 😃

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [August 26, 2019, 11:48am UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/14 "2019-08-26T11:48:25Z")

</div>

It’s a tough one. Reminds of Python 2 - Python 3 transition. Haha.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 26, 2019, 12:47pm UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/15 "2019-08-26T12:47:45Z")

</div>

> [@juliohm](#):
>
> I think the issue here is more profound. Whenever a decision is made by package authors to deprecate a function name, it should be assessed first with the entire community of users, maybe a post on discourse? Without any attempt to consult the users, the community will feel ignored.

Maybe you can lead by example here. For example, this commit: [Move Kriging solvers to KrigingEstimators.jl · JuliaEarth/GeoStats.jl@7a064b8 · GitHub](https://github.com/juliohm/GeoStats.jl/commit/7a064b8e573f9d048bf01f3a907fd64b526f327b) might be quite disruptive to the community, forcing them to install another package to use the functionality. Maybe this should have been discussed by the community here on discourse first? Will you start opening discourse post for discussions about any API change you make in the future?

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [August 26, 2019, 12:56pm UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/16 "2019-08-26T12:56:48Z")

</div>

None of those changes had any impact on end users. I just moved things around inside the project packages. And really, you want to compare the size of the GeoStats.jl community to the size of Dataframes.jl? The latter is much larger. GeoStats.jl is an ant compared to DataFrames.jl in number of users.

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [August 26, 2019, 1:06pm UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/17 "2019-08-26T13:06:18Z")

</div>

This does raise a valid question of how can package authors more readily access feedback on proposed changes. 99.9% of users do not just go read open GitHub PRs on the packages they use. Perhaps this is another situation where having beta versions of packages easily made available via `Pkg` could help? That doesn’t seem like the only or best solution though.

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [August 26, 2019, 1:39pm UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/18 "2019-08-26T13:39:35Z")

</div>

Come on, this change has been released months ago without anybody complaining, and suddenly it’s a major blocker?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 26, 2019, 1:43pm UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/19 "2019-08-26T13:43:18Z")

</div>

> [@tbeason](#):
>
> This does raise a valid question of how can package authors more readily access feedback on proposed changes.

You’re assuming that package authors feel that they need more feedback. When that is the case, opening a topic on discourse is very simple. If you personally want more of a say in the development of a package, start contributing to it.

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [August 26, 2019, 1:47pm UTC](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988/20 "2019-08-26T13:47:11Z")

</div>

> [@nalimilan](#):
>
> Come on, this change has been released months ago without anybody complaining, and suddenly it’s a major blocker

Maybe I should have said something then…

[Next page](https://discourse.julialang.org/t/i-might-have-missed-this-but-why-is-head-df-abstractdataframe-deprecated/27988.md?page=2)
