メインコンテンツまでスキップ

範囲(SparkSession)

DataFrameを作成し、 idという名前の単一のLongType列を含み、 startからend (排他的) の範囲の要素をステップ値stepで格納します。

構文

range(start, end=None, step=1, numPartitions=None)

パラメーター

パラメーター

Type

説明

start

int

開始値。

end

整数、オプション

最終価格(税抜)。省略した場合、 start終了値として使用され、範囲は0から始まります。

step

整数、オプション

増分ステップ(デフォルト: 1 )。

numPartitions

整数、オプション

DataFrameの分割数。

戻り値

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|
# +---+
このページの見出し