databricks.koalas.DataFrame.spark.print_schema

spark.print_schema(index_col: Union[str, List[str], None] = None) → None

Prints out the underlying Spark schema in the tree format.

Parameters
index_col: str or list of str, optional, default: None

Column names to be used in Spark to represent Koalas’ index. The index name in Koalas is ignored. By default, the index is always lost.

Returns
None

Examples

>>> df = ks.DataFrame({'a': list('abc'),
...                    'b': list(range(1, 4)),
...                    'c': np.arange(3, 6).astype('i1'),
...                    'd': np.arange(4.0, 7.0, dtype='float64'),
...                    'e': [True, False, True],
...                    'f': pd.date_range('20130101', periods=3)},
...                   columns=['a', 'b', 'c', 'd', 'e', 'f'])
>>> df.spark.print_schema()  
root
 |-- a: string (nullable = false)
 |-- b: long (nullable = false)
 |-- c: byte (nullable = false)
 |-- d: double (nullable = false)
 |-- e: boolean (nullable = false)
 |-- f: timestamp (nullable = false)
>>> df.spark.print_schema(index_col='index')  
root
 |-- index: long (nullable = false)
 |-- a: string (nullable = false)
 |-- b: long (nullable = false)
 |-- c: byte (nullable = false)
 |-- d: double (nullable = false)
 |-- e: boolean (nullable = false)
 |-- f: timestamp (nullable = false)