Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Adds input options for the underlying data source.
Syntax
options(**options)
Parameters
| Parameter | Type | Description |
|---|---|---|
**options |
dict | String keys mapped to primitive-type values. For available options, see DataFrameReader options. |
Returns
DataFrameReader
Examples
Read a CSV file with nullValue and header options set.
import tempfile
with tempfile.TemporaryDirectory(prefix="options") as d:
df = spark.createDataFrame([{"age": 100, "name": "Alice"}])
df.write.option("header", True).mode("overwrite").format("csv").save(d)
spark.read.options(
nullValue="Alice",
header=True
).format('csv').load(d).show()
# +---+----+
# |age|name|
# +---+----+
# |100|NULL|
# +---+----+