'How to convert print output to pyspark dataframe (no pandas allowed)

The usual code

print((sparkdf.count(), len(sparkdf.columns)))

Since I using HDFS system that fully on HDFS, no pandas allowed, The output I need

|-------|-------|
|row    |columns|
|-------|-------|
|1500   |    22 |
|-------|-------|



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source