HyukjinKwon commented on a change in pull request #34931:
URL: https://github.com/apache/spark/pull/34931#discussion_r771125412
##########
File path: python/pyspark/pandas/frame.py
##########
@@ -8809,16 +8813,26 @@ def describe(self, percentiles: Optional[List[float]] =
None) -> "DataFrame":
max 3.0
Name: numeric1, dtype: float64
"""
- exprs = []
+ exprs_numeric = []
+ exprs_non_numeric = []
column_labels = []
+ # For storing the name of non-numeric type columns
+ column_names = []
+ is_timestamp_types = []
for label in self._internal.column_labels:
psser = self._psser_for(label)
- if isinstance(psser.spark.data_type, NumericType):
- exprs.append(psser._dtype_op.nan_to_null(psser).spark.column)
+ spark_data_type = psser.spark.data_type
+ if isinstance(spark_data_type, NumericType):
+
exprs_numeric.append(psser._dtype_op.nan_to_null(psser).spark.column)
column_labels.append(label)
-
- if len(exprs) == 0:
- raise ValueError("Cannot describe a DataFrame without columns")
+ else:
+ exprs_non_numeric.append(psser.spark.column)
+ column_names.append(label[0])
+ # For the timestamp type we also need to retreive the `first`
and `last`.
+ if isinstance(spark_data_type, TimestampType):
+ is_timestamp_types.append(True)
Review comment:
`is_timestamp_types.append(isinstance(spark_data_type, TimestampType))`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]