pyspark.pandas.DataFrame.ndim

property DataFrame.ndim

Return an int representing the number of array dimensions.

return 2 for DataFrame.

Examples

>>> df = ps.DataFrame([[1, 2], [4, 5], [7, 8]],
...                   index=['cobra', 'viper', None],
...                   columns=['max_speed', 'shield'])
>>> df
       max_speed  shield
cobra          1       2
viper          4       5
NaN            7       8
>>> df.ndim
2