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.
Returns a DataFrameReader that can be used to read data as a DataFrame.
Syntax
read
Returns
DataFrameReader
Examples
import tempfile
with tempfile.TemporaryDirectory(prefix="read") as d:
# Write a DataFrame into a JSON file.
spark.createDataFrame(
[{"age": 100, "name": "Alice"}]
).write.mode("overwrite").format("json").save(d)
# Read the JSON file as a DataFrame.
spark.read.format('json').load(d).show()
# +---+------------+
# |age| name|
# +---+------------+
# |100|Alice|
# +---+------------+