Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch renamecol to rename and insertcol to insertcols, add multiple column version #241

Merged
merged 5 commits into from
Apr 16, 2019

Conversation

piever
Copy link
Collaborator

@piever piever commented Apr 15, 2019

This is the last part of #239, renaming renamecol to renamecols and deprecating insertcol to insertcols plus multiple columns version.

Two doubts:

  1. Should the name be renamecols or just rename? After all we are obviously renaming columns (it wouldn't make to rename rows). Maybe we should just be consistent with DataFrames and call it rename.

  2. I've interpreted the "multiple argument" version of insertcols! to behave as follows:

julia> t = table(rand(3), rand(3), rand(3), names = [:a,:b,:c])
Table with 3 rows, 3 columns:
a         b         c
────────────────────────────
0.509087  0.763431  0.557554
0.217274  0.801138  0.160908
0.462436  0.506603  0.921267

julia> insertcols(t, 2, :d => rand(3), :e => rand(3))
Table with 3 rows, 5 columns:
a         d         e         b         c
────────────────────────────────────────────────
0.509087  0.212275  0.683083  0.763431  0.557554
0.217274  0.49579   0.516921  0.801138  0.160908
0.462436  0.404024  0.982535  0.506603  0.921267

julia> insertcolsbefore(t, :c, :d => rand(3), :e => rand(3))
Table with 3 rows, 5 columns:
a         b         d          e         c
─────────────────────────────────────────────────
0.509087  0.763431  0.730766   0.263156  0.557554
0.217274  0.801138  0.844378   0.915973  0.160908
0.462436  0.506603  0.0846812  0.163381  0.921267

That is, we pass a unique index and all columns are inserted starting from there. I thought the version with multiple indices would be too confusing as the indices would change position when the first columns are inserted. Does this make sense?

@joshday
Copy link
Collaborator

joshday commented Apr 15, 2019

  1. I vote for rename.
  2. Does it make sense? Yes.

@piever piever changed the title Switch renamecol and insertcol to plural, add multiple column version Switch renamecol to rename and insertcol to insertcols, add multiple column version Apr 15, 2019
@piever piever merged commit 6b77f9f into master Apr 16, 2019
@piever piever deleted the pv/rename branch April 16, 2019 13:26
@piever
Copy link
Collaborator Author

piever commented Apr 16, 2019

OK, I'm going with rename (simpler and in agreement with DataFrames).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants