הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
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|
# +---+----+