forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-49344][PS] Support
json_normalize
for Pandas API on Spark
### What changes were proposed in this pull request? This PR proposes to support `json_normalize` for Pandas API on Spark. ### Why are the changes needed? For Pandas feature parity: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.json_normalize.html ### Does this PR introduce _any_ user-facing change? Introduce new API `ps.json_normalize` ```python >>> data = [ ... {"id": 1, "name": "Alice", "address": {"city": "NYC", "zipcode": "10001"}}, ... {"id": 2, "name": "Bob", "address": {"city": "SF", "zipcode": "94105"}}, ... ] >>> ps.json_normalize(data) id name address.city address.zipcode 0 1 Alice NYC 10001 1 2 Bob SF 94105 ``` ### How was this patch tested? Added UTs ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#47840 from itholic/json_normalize. Lead-authored-by: Haejoon Lee <haejoon.lee@databricks.com> Co-authored-by: Hyukjin Kwon <gurwls223@gmail.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
- Loading branch information
1 parent
853731d
commit 08d69ff
Showing
3 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,6 +105,7 @@ JSON | |
.. autosummary:: | ||
:toctree: api/ | ||
|
||
json_normalize | ||
read_json | ||
DataFrame.to_json | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters