You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/11/01 22:14:21 UTC

[GitHub] [spark] xinrong-meng opened a new pull request, #38473: [SPARK-40990][PYTHON] DataFrame creation from 2d NumPy array with arbitrary columns

xinrong-meng opened a new pull request, #38473:
URL: https://github.com/apache/spark/pull/38473

   ### What changes were proposed in this pull request?
   Support DataFrame creation from 2d NumPy array with arbitrary columns.
   
   ### Why are the changes needed?
   Currently, DataFrame creation from 2d ndarray works only with 2 columns. We should provide complete support for DataFrame creation with 2d ndarray. 
   
   As part of [SPARK-39405](https://issues.apache.org/jira/browse/SPARK-39405).
   
   ### Does this PR introduce _any_ user-facing change?
   Yes.
   Before
   ```py
   >>> spark.createDataFrame(np.array([[1], [2]])).dtypes
   Traceback (most recent call last):
   ...
       raise ValueError(f"Shape of passed values is {passed}, indices imply {implied}")
   ValueError: Shape of passed values is (2, 1), indices imply (2, 2)
   
   
   >>> spark.createDataFrame(np.array([[1, 1, 1], [2, 2, 2]])).dtypes
   Traceback (most recent call last):
   ...
       raise ValueError(f"Shape of passed values is {passed}, indices imply {implied}")
   ValueError: Shape of passed values is (2, 3), indices imply (2, 2)
   ```
   
   After
   ```py
   >>> spark.createDataFrame(np.array([[1], [2]])).dtypes
   [('value', 'bigint')]
   
   >>> spark.createDataFrame(np.array([[1, 1, 1], [2, 2, 2]])).dtypes
   [('_1', 'bigint'), ('_2', 'bigint'), ('_3', 'bigint')]
   ```
   
   ### How was this patch tested?
   Unit tests.
   
   


-- 
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


[GitHub] [spark] HyukjinKwon commented on pull request #38473: [SPARK-40990][PYTHON] DataFrame creation from 2d NumPy array with arbitrary columns

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on PR #38473:
URL: https://github.com/apache/spark/pull/38473#issuecomment-1299413739

   Merged to master.


-- 
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


[GitHub] [spark] HyukjinKwon closed pull request #38473: [SPARK-40990][PYTHON] DataFrame creation from 2d NumPy array with arbitrary columns

Posted by GitBox <gi...@apache.org>.
HyukjinKwon closed pull request #38473: [SPARK-40990][PYTHON] DataFrame creation from 2d NumPy array with arbitrary columns
URL: https://github.com/apache/spark/pull/38473


-- 
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