DataAPI.jl icon indicating copy to clipboard operation
DataAPI.jl copied to clipboard

Define `rename` and `rename!` for modifying column names?

Open junyuan-chen opened this issue 2 years ago • 3 comments

I thought it would be useful to define rename and rename! in DataAPI.jl for functions that achieve purposes similar to what they do for DataFrames.jl.

junyuan-chen avatar Nov 08 '22 21:11 junyuan-chen

What other package wants to use these names? Note that DataAPI.jl in general just defines function names, mostly without providing implementations. The purpose of this package is to avoid function name clashes. Maybe you also want to propose adding these to https://github.com/JuliaData/TableOperations.jl?

bkamins avatar Nov 08 '22 22:11 bkamins

I am considering having such functions for ReadStatTables.jl. At this moment, renaming column names is not immediately needed. However, with future implementation of writing support for the Stata/SAS/SPSS data files, modifying column names in-place should be useful. For example, one may load data from a file and rename the columns before saving them somewhere else. Directly changing the column names avoid the need of moving metadata carried with the columns around for a simple task like this.

I just realized that there was some discussion here.

junyuan-chen avatar Nov 08 '22 22:11 junyuan-chen

OK - if you want to add them in ReadStatTables.jl then it makes sense to add them to DataAPI.jl.

@nalimilan - do you see any issues with this?

bkamins avatar Nov 08 '22 22:11 bkamins