You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "dzhigimont (via GitHub)" <gi...@apache.org> on 2023/08/30 19:19:20 UTC

[GitHub] [spark] dzhigimont commented on a diff in pull request #40436: [SPARK-42619][PS] Add `show_counts` parameter for DataFrame.info

dzhigimont commented on code in PR #40436:
URL: https://github.com/apache/spark/pull/40436#discussion_r1310717375


##########
python/pyspark/pandas/indexes/base.py:
##########
@@ -289,7 +289,7 @@ def _summary(self, name: Optional[str] = None) -> str:
 
         if name is None:
             name = type(self).__name__
-        return "%s: %s entries%s" % (name, total_count, index_summary)
+        return "%s: %s entries%s" % (name, int(total_count), index_summary)

Review Comment:
   When I was writing tests for the info method I found out that it prints different outputs and the difference was that pandas return:
   ```
   Index: 9 entries, 0.6658222030375259 to 0.7862583284518239
   Data columns (total 2 columns):
    #   Column  Non-Null Count  Dtype
   ---  ------  --------------  -----
    0   a       9 non-null      int64
    1   b       9 non-null      int64
   ```
   but spark pandas api return 
   ```
   Index: 9.0 entries, 0.6658222030375259 to 0.7862583284518239
   Data columns (total 2 columns):
    #   Column  Non-Null Count  Dtype
   ---  ------  --------------  -----
    0   a       9 non-null      int64
    1   b       9 non-null      int64
   ```
   So to align outputs I've done the fix
   
   



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org