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
22 days agoLacey
23 days agoTommy
3 days agoFausto
6 days agoLevi
24 days agoClay
26 days agoTijuana
6 days agoIesha
12 days agoAugustine
18 days agoNoah
1 months agoDomingo
1 days agoCristy
3 days agoTricia
17 days agoNathan
1 months agoIluminada
2 days agoBoris
7 days agoAileen
10 days agoLucia
1 months agoDan
2 months agoRoslyn
2 months agoFrancoise
13 days agoRodolfo
29 days agoTwanna
1 months agoDion
2 months agoRoxanne
2 months agoDean
2 months agoTatum
2 months agoCurt
2 months ago