Project

General

Profile

Actions

Feature #13706

closed

Allow CSV#delete to delete multiple columns or add #delete_columns method

Added by wowinter13 (Vladislav Dyachenko) almost 7 years ago. Updated about 6 years ago.

Status:
Closed
Target version:
-
[ruby-core:81881]

Description

I duplicated the main report message from this PR: https://github.com/ruby/csv/pull/4
The basic idea is that now we can delete only one column using #delete

csv_table.delete("PassengerId") csv_table.delete("Survived") csv_table.delete("Name") csv_table.to_csv

The best working way for me to do it with multiple columns:
to_del = ["Name", "Ticket"] csv_table = datus.by_col!.delete_if { |name, values| !to_del.include? name}

But maybe it should work like this?
to_del = ["Name", "Ticket"] data.delete(to_del)

Updated by hsbt (Hiroshi SHIBATA) about 6 years ago

  • Status changed from Open to Closed
  • Assignee set to kou (Kouhei Sutou)
Actions

Also available in: Atom PDF

Like0
Like0