範囲(SparkSession)
DataFrameを作成し、 idという名前の単一のLongType列を含み、 startからend (排他的) の範囲の要素をステップ値stepで格納します。
構文
range(start, end=None, step=1, numPartitions=None)
パラメーター
パラメーター | Type | 説明 |
|---|---|---|
| int | 開始値。 |
| 整数、オプション | 最終価格(税抜)。省略した場合、 |
| 整数、オプション | 増分ステップ(デフォルト: |
| 整数、オプション |
|
戻り値
DataFrame
例
Python
spark.range(1, 7, 2).show()
# +---+
# | id|
# +---+
# | 1|
# | 3|
# | 5|
# +---+
# If only one argument is specified, it is used as the end value.
spark.range(3).show()
# +---+
# | id|
# +---+
# | 0|
# | 1|
# | 2|
# +---+