red-data-tools/red-datasets

nil key in seaborn-data

heronshoes opened this issue · 1 comments

Dataset below in seaborn-data, #to_a, #to_table.column_names ,etc will fail.

  • attention
  • exercise

This is because these datasets have nil key as an index column.

I will make a fix to change nil to :index.

(FYI)
Another way is to remove column with nil key like Rdatasets .

# in rdatasets.rb
      CSV.open(@data_path, headers: :first_row, converters: :all) do |csv|
        csv.each do |row|
          record = row.to_h
          record.delete("")  # <==(line 88)
          record.transform_keys!(&:to_sym)
          yield record