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
2 months agoLacey
2 months agoMatthew
19 days agoLonny
1 months agoTommy
1 months agoFausto
1 months agoLevi
2 months agoClay
2 months agoTijuana
1 months agoIesha
2 months agoAugustine
2 months agoNoah
2 months agoDomingo
1 months agoCristy
1 months agoTricia
2 months agoNathan
3 months agoIluminada
1 months agoBoris
1 months agoAileen
2 months agoLucia
2 months agoDan
3 months agoRoslyn
3 months agoFrancoise
2 months agoRodolfo
2 months agoTwanna
3 months agoDion
3 months agoRoxanne
3 months agoDean
3 months agoTatum
3 months agoCurt
3 months ago