264件ヒット
[1-100件を表示]
(0.021秒)
種類
- インスタンスメソッド (253)
- 特異メソッド (11)
ライブラリ
- csv (264)
検索結果
先頭5件
-
CSV
:: Table # by _ row -> CSV :: Table (9411.0) -
ロウモードになっている新しい CSV::Table オブジェクトを返します。
...ロウモードになっている新しい CSV::Table オブジェクトを返します。
元のテーブルモードを変更せずにメソッドチェーンできるので便利です。しか
し、大きなデータセットに対しても同じだけメモリを消費するので気をつ......re "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
table # => #<CSV::Table mode:col_or_row row_count:3>
row_table = table.by_row # => #<CSV::Table mode:row row_cou......nt:3>
row_table[0] # => #<CSV::Row "header1":"row1_1" "header2":"row1_2">
row_table[1] # => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
//}... -
CSV
:: Table # by _ col _ or _ row -> CSV :: Table (9363.0) -
ミックスモードになっている新しい CSV::Table オブジェクトを返します。
...ミックスモードになっている新しい CSV::Table オブジェクトを返します。
元のテーブルモードを変更せずにメソッドチェーンできるので便利です。しか
し、大きなデータセットに対しても同じだけメモリを消費するので気......ire "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2]).by_col!
table # => #<CSV::Table mode:col row_count:3>
col_or_row_table = table.by_col_or_row
col_or_row_tabl......e # => #<CSV::Table mode:col_or_row row_count:3>
table # => #<CSV::Table mode:col row_count:3>
//}... -
CSV
:: Table # by _ row! -> self (9276.0) -
自身をロウモードに変更します。
...e "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
table # => #<CSV::Table mode:col_or_row row_count:3>
table.by_row!
table # => #<CSV::Table mode:row row_co......unt:3>
table[0] # => #<CSV::Row "header1":"row1_1" "header2":"row1_2">
table[1] # => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
//}... -
CSV
:: Table # by _ col _ or _ row! -> self (9222.0) -
自身をミックスモードに変更します。
..."csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2]).by_col!
table # => #<CSV::Table mode:col row_count:3>
table.by_col_or_row!
table # => #<CSV::Table......mode:col_or_row row_count:3>
//}... -
CSV
:: Table # [](index) -> CSV :: Row | [String] | nil (3589.0) -
ミックスモードでは、このメソッドは引数に行番号を指定すれば行単位で動作 し、ヘッダの名前を指定すれば列単位で動作します。
...ダの名前を指定すれば列単位で動作します。
このメソッドを呼び出す前に CSV::Table#by_col! を呼び出すとカラム
モードになります。また CSV::Table#by_row! を呼び出すとロウモード
になります。
@param index ミックスモード・ロウ......equire "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
# ミックスモード
p table.mode # => :col_or_row
p table[0] # => #<CSV::Row "header1":"row1_1" "h......eader2":"row1_2">
p table[1] # => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
p table["header2"] # => ["row1_2", "row2_2"]
p table[0..1] # => [#<CSV::Row "header1":"row1_1" "header2":"row1_2">, #<CSV::Row "header1":"row2_1" "header2":"row2_2">]
# カラムモード
table.by_col!... -
CSV
:: Table # [](range) -> [CSV :: Row]| [Array] | nil (3589.0) -
ミックスモードでは、このメソッドは引数に行番号を指定すれば行単位で動作 し、ヘッダの名前を指定すれば列単位で動作します。
...ダの名前を指定すれば列単位で動作します。
このメソッドを呼び出す前に CSV::Table#by_col! を呼び出すとカラム
モードになります。また CSV::Table#by_row! を呼び出すとロウモード
になります。
@param index ミックスモード・ロウ......equire "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
# ミックスモード
p table.mode # => :col_or_row
p table[0] # => #<CSV::Row "header1":"row1_1" "h......eader2":"row1_2">
p table[1] # => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
p table["header2"] # => ["row1_2", "row2_2"]
p table[0..1] # => [#<CSV::Row "header1":"row1_1" "header2":"row1_2">, #<CSV::Row "header1":"row2_1" "header2":"row2_2">]
# カラムモード
table.by_col!... -
CSV
:: Table # each {|row| . . . } -> self (3462.0) -
デフォルトのミックスモードかロウモードでは、行単位で繰り返します。カラ ムモードでは、ブロックに列名と対応する値の配列を与え、列単位で繰り返し ます。
...ire "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
row3 = CSV::Row.new(["header1", "header2"], ["row3_1", "row3_2"])
table = CSV::Table.new([row1, row2, row3])
table.each { |row| p row }
# => #<CSV::Row "hea......der1":"row1_1" "header2":"row1_2">
# => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
# => #<CSV::Row "header1":"row3_1" "header2":"row3_2">
//}
//emlist[例 カラムモード][ruby]{
require "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1......, ["row2_1", "row2_2"])
row3 = CSV::Row.new(["header1", "header2"], ["row3_1", "row3_2"])
table = CSV::Table.new([row1, row2, row3])
table.by_col!
table.each { |column_name, values| print column_name, values, "\n" }
# => header1["row1_1", "row2_1", "row3_1"]
# => header2["row1_2", "row2_2", "row3_2... -
CSV
:: Table # [](header) -> [String] | [nil] (3389.0) -
ミックスモードでは、このメソッドは引数に行番号を指定すれば行単位で動作 し、ヘッダの名前を指定すれば列単位で動作します。
...ダの名前を指定すれば列単位で動作します。
このメソッドを呼び出す前に CSV::Table#by_col! を呼び出すとカラム
モードになります。また CSV::Table#by_row! を呼び出すとロウモード
になります。
@param index ミックスモード・ロウ......equire "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
# ミックスモード
p table.mode # => :col_or_row
p table[0] # => #<CSV::Row "header1":"row1_1" "h......eader2":"row1_2">
p table[1] # => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
p table["header2"] # => ["row1_2", "row2_2"]
p table[0..1] # => [#<CSV::Row "header1":"row1_1" "header2":"row1_2">, #<CSV::Row "header1":"row2_1" "header2":"row2_2">]
# カラムモード
table.by_col!... -
CSV
:: Table # each {|column _ name , values| . . . } -> self (3362.0) -
デフォルトのミックスモードかロウモードでは、行単位で繰り返します。カラ ムモードでは、ブロックに列名と対応する値の配列を与え、列単位で繰り返し ます。
...ire "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
row3 = CSV::Row.new(["header1", "header2"], ["row3_1", "row3_2"])
table = CSV::Table.new([row1, row2, row3])
table.each { |row| p row }
# => #<CSV::Row "hea......der1":"row1_1" "header2":"row1_2">
# => #<CSV::Row "header1":"row2_1" "header2":"row2_2">
# => #<CSV::Row "header1":"row3_1" "header2":"row3_2">
//}
//emlist[例 カラムモード][ruby]{
require "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1......, ["row2_1", "row2_2"])
row3 = CSV::Row.new(["header1", "header2"], ["row3_1", "row3_2"])
table = CSV::Table.new([row1, row2, row3])
table.by_col!
table.each { |column_name, values| print column_name, values, "\n" }
# => header1["row1_1", "row2_1", "row3_1"]
# => header2["row1_2", "row2_2", "row3_2... -
CSV
:: Table . new(array _ of _ rows) -> CSV :: Table (3322.0) -
自身を初期化します。
...@param array_of_rows CSV::Row のインスタンスの配列を指定します。
//emlist[例][ruby]{
require "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
table.to_a #......=> [["header1", "header2"], ["row1_1", "row1_2"], ["row2_1", "row2_2"]]
//}...