Which of the following code blocks shows the structure of a DataFrame in a tree-like way, containing both column names and types?
itemsDf.printSchema()
Correct! Here is an example of what itemsDf.printSchema() shows, you can see the tree-like structure containing both column names and types:
root
|-- itemId: integer (nullable = true)
|-- attributes: array (nullable = true)
| |-- element: string (containsNull = true)
|-- supplier: string (nullable = true)
itemsDf.rdd.printSchema()
No, the DataFrame's underlying RDD does not have a printSchema() method.
spark.schema(itemsDf)
Incorrect, there is no spark.schema command.
print(itemsDf.columns)
print(itemsDf.dtypes)
Wrong. While the output of this code blocks contains both column names and column types, the information is not arranges in a tree-like way.
itemsDf.print.schema()
No, DataFrame does not have a print method.
Static notebook | Dynamic notebook: See test 3, Question: 36 (Databricks import instructions)
Mona
8 months agoLacey
9 months agoMatthew
7 months agoLonny
8 months agoTommy
8 months agoFausto
8 months agoLevi
9 months agoClay
9 months agoTijuana
8 months agoIesha
8 months agoAugustine
8 months agoNoah
9 months agoDomingo
8 months agoCristy
8 months agoTricia
8 months agoNathan
9 months agoIluminada
8 months agoBoris
8 months agoAileen
8 months agoLucia
9 months agoDan
9 months agoRoslyn
10 months agoFrancoise
8 months agoRodolfo
9 months agoTwanna
9 months agoDion
10 months agoRoxanne
10 months agoDean
9 months agoTatum
9 months agoCurt
10 months ago