Julia: columns, rows & slices views

Created on 13 Jun 2019  路  4Comments  路  Source: JuliaLang/julia

https://github.com/JuliaLang/julia/pull/32310 made me think of a discussion I'd had about data frames and wanting to be able to write columns(df) to access a data frame as a collection of columns. We could make eachcol(df) work like that but the each in the name gets a bit weird. So perhaps we might want to rename (or alias until 2.0) eachcol to columns and make it act more like a view of the underlying collection than as just an iterator. There would be corresponding rows and slices view wrappers. Thoughts?

arrays speculative

Most helpful comment

The approach would be to make rows, columns and slices the primary names and leave the each* versions around but document them as being deprecated and then actually deprecate them in 2.0.

All 4 comments

In DataFrames.jl eachcol and eachrow already produce AbstractArray objects. eachcol and eachrow were simply legacy names (and consistent with Base).

Therefore, at least from DataFrames.jl perspective it is not a problem if in Base the following decision were made:

  • start using columns and rows as target function names and define const eachcol = columns and const eachrow = rows temporarily;
  • in some future time drop eachrow and eachcol aliases

Indeed the "each" prefix sounds a bit off when the function returns (or could return) an AbstractVector, so +1 to switching to rows, columns and slices.

The approach would be to make rows, columns and slices the primary names and leave the each* versions around but document them as being deprecated and then actually deprecate them in 2.0.

+1 for this change. Although this was originally discussed in #14491 (comment), where it was decided against rows, columns, slices and in favor of each*.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omus picture omus  路  3Comments

manor picture manor  路  3Comments

StefanKarpinski picture StefanKarpinski  路  3Comments

Keno picture Keno  路  3Comments

felixrehren picture felixrehren  路  3Comments