るりまサーチ

最速Rubyリファレンスマニュアル検索!
204件ヒット [1-100件を表示] (0.014秒)
トップページ > クエリ:row[x] > クエリ:mode[x]

別のキーワード

  1. matrix row
  2. csv header_row?
  3. row []=
  4. csv row
  5. csv row_sep

ライブラリ

クラス

キーワード

検索結果

<< 1 2 3 > >>

CSV::Table#mode -> Symbol (18149.0)

現在のアクセスモードを返します。

...現在のアクセスモードを返します。

//emlist[例][ruby]{
require "csv"

row
= CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
table = CSV::Table.new([row])
table.mode # => :col_or_row
table.by_col!
table.mode # => :col
//}...

CSV::Table#by_row -> CSV::Table (6257.0)

ロウモードになっている新しい CSV::Table オブジェクトを返します。

..."csv"

row
1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row
2 = 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_count...
...: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_row! -> self (6239.0)

自身をロウモードに変更します。

..."csv"

row
1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row
2 = 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_coun...
...t: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 -> CSV::Table (6221.0)

ミックスモードになっている新しい CSV::Table オブジェクトを返します。

...e "csv"

row
1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row
2 = 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_table...
...# => #<CSV::Table mode:col_or_row row_count:3>
table # => #<CSV::Table mode:col row_count:3>
//}...

CSV::Table#by_col_or_row! -> self (6197.0)

自身をミックスモードに変更します。

..."

row
1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row
2 = 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 (420.0)

ミックスモードでは、このメソッドは引数に行番号を指定すれば行単位で動作 し、ヘッダの名前を指定すれば列単位で動作します。

...します。

このメソッドを呼び出す前に CSV::Table#by_col! を呼び出すとカラム
モードになります。また CSV::Table#by_row! を呼び出すとロウモード
になります。

@param index ミックスモード・ロウモードでは、取得したい行の行番号...
...

row
1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row
2 = 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" "header2":"row...
...# => #<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!
p table.mode # => :col
p...

CSV::Table#[](range) -> [CSV::Row]| [Array] | nil (420.0)

ミックスモードでは、このメソッドは引数に行番号を指定すれば行単位で動作 し、ヘッダの名前を指定すれば列単位で動作します。

...します。

このメソッドを呼び出す前に CSV::Table#by_col! を呼び出すとカラム
モードになります。また CSV::Table#by_row! を呼び出すとロウモード
になります。

@param index ミックスモード・ロウモードでは、取得したい行の行番号...
...

row
1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row
2 = 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" "header2":"row...
...# => #<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!
p table.mode # => :col
p...

CSV::Table#[](header) -> [String] | [nil] (320.0)

ミックスモードでは、このメソッドは引数に行番号を指定すれば行単位で動作 し、ヘッダの名前を指定すれば列単位で動作します。

...します。

このメソッドを呼び出す前に CSV::Table#by_col! を呼び出すとカラム
モードになります。また CSV::Table#by_row! を呼び出すとロウモード
になります。

@param index ミックスモード・ロウモードでは、取得したい行の行番号...
...

row
1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row
2 = 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" "header2":"row...
...# => #<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!
p table.mode # => :col
p...

CSV.open(filename, mode = "rb", options = Hash.new) -> CSV (144.0)

このメソッドは IO オブジェクトをオープンして CSV でラップします。 これは CSV ファイルを書くための主要なインターフェイスとして使うことを意図しています。

...oding.default_external と異なる場合は、mode にエンコー
ディングを指定する文字列を埋め込まなければなりません。データをどのよう
に解析するか決定するために CSV ライブラリはユーザが mode に指定したエン
コーディングをチ...
...ェックします。"rb:UTF-32BE:UTF-8" のように mode を指定
すると UTF-32BE のデータを読み込んでUTF-8 に変換してから解析します。

また "rb:BOM|UTF-8" のように mode を指定すると BOM を自動的に取り除きま
す。

CSV オブジェクトは多く...
...aro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
csv = CSV.open("test.csv", headers: true)
csv.class # => CSV
csv.first # => #<CSV::Row "id":"1" "first name":"taro" "last name":"tanaka" "age":"20">
//}

//emlist[例 読み取り・ブロック指定あり][ruby]{
require "csv"

user...
<< 1 2 3 > >>