You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If i understand correctly, CSV v1 does not accept functions for the drop argument anymore, in favor of Tables.Scan. one problem with this is that Tables.Scan only works on the actual names of the columns, whereas the function i am using performs a transformation on the column name before the selection procedure.
The function is the following:
function_drop(i,name)
norm_header =normalisestring(name)
normalisestring(norm_header; tofilter=r"[ \-\_\d]") ∈ ignorelist #ignorelist is an user-supplied listendfunctionnormalisestring(str; tofilter ='')
res = Base.Unicode.normalize(str,casefold=true,stripmark=true)
returnreplace(res, tofilter =>"")
end
what can be done to migrate this workflow to CSV v1?
Thanks for the report. #1210 brings back function-valued select and drop, and releases them as CSV 1.2.0. After that release, your 0.10 code works again:
CSV.File(path; drop=_drop)
As in 0.10, the function receives the column position and the column name as a Symbol. Call String(name) before Unicode.normalize, because normalize does not accept a Symbol.
Until 1.2.0 is registered, you can compute the mask from the header names first on CSV 1.0 or 1.1:
using CSV, Tables
lf = CSV.lazy(path) # reads the header and builds the structural index once
mask = [_drop(i, nm) for (i, nm) inenumerate(Tables.columnnames(lf))]
file = CSV.File(lf; drop=mask) # parses from the same index
CSV.File(lf) reuses the index from CSV.lazy, so this costs about the same as one read. For CSV.Rows or CSV.Chunks, get the names with Tables.columnnames(CSV.File(path; limit=0)) and pass the same drop=mask.
Activity
quinnj commentedon Sep 23, 2026
[PR link description generated by AI]
Thanks for the report. #1210 brings back function-valued
selectanddrop, and releases them as CSV 1.2.0. After that release, your 0.10 code works again:As in 0.10, the function receives the column position and the column name as a
Symbol. CallString(name)beforeUnicode.normalize, becausenormalizedoes not accept aSymbol.Until 1.2.0 is registered, you can compute the mask from the header names first on CSV 1.0 or 1.1:
CSV.File(lf)reuses the index fromCSV.lazy, so this costs about the same as one read. ForCSV.RowsorCSV.Chunks, get the names withTables.columnnames(CSV.File(path; limit=0))and pass the samedrop=mask.