Skip to content

Commit

Permalink
[SPARK-46926][PS] Add convert_dtypes, infer_objects and `set_axis…
Browse files Browse the repository at this point in the history
…` in fallback list

### What changes were proposed in this pull request?
Add `convert_dtypes`, `infer_objects` and `set_axis` in fallback list

### Why are the changes needed?
for pandas parity

### Does this PR introduce _any_ user-facing change?
these apis are disabled by default

### How was this patch tested?
manually check with the latest pandas examples

### Was this patch authored or co-authored using generative AI tooling?
no

Closes apache#44965 from zhengruifeng/ps_add_fallback_list.

Authored-by: Ruifeng Zheng <[email protected]>
Signed-off-by: Ruifeng Zheng <[email protected]>
  • Loading branch information
zhengruifeng committed Jan 31, 2024
1 parent 8f40621 commit 5d87ac6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion python/pyspark/pandas/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -13490,7 +13490,13 @@ def __getattr__(self, key: str) -> Any:
if key.startswith("__"):
raise AttributeError(key)
if hasattr(MissingPandasLikeDataFrame, key):
if key in ["asfreq", "asof"] and get_option("compute.pandas_fallback"):
if key in [
"asfreq",
"asof",
"convert_dtypes",
"infer_objects",
"set_axis",
] and get_option("compute.pandas_fallback"):
return self._fall_back_frame(key)

property_or_func = getattr(MissingPandasLikeDataFrame, key)
Expand Down
4 changes: 3 additions & 1 deletion python/pyspark/pandas/missing/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class MissingPandasLikeDataFrame:
reorder_levels = _unsupported_function("reorder_levels")
set_axis = _unsupported_function("set_axis")
to_feather = _unsupported_function("to_feather")
to_gbq = _unsupported_function("to_gbq")
to_hdf = _unsupported_function("to_hdf")
to_period = _unsupported_function("to_period")
to_sql = _unsupported_function("to_sql")
Expand All @@ -56,6 +55,9 @@ class MissingPandasLikeDataFrame:
lookup = _unsupported_function(
"lookup", deprecated=True, reason="Use DataFrame.melt and DataFrame.loc instead."
)
to_gbq = _unsupported_function(
"to_gbq", deprecated=True, reason="Use pandas_gbq.to_gbq instead."
)

# Functions we won't support.
to_pickle = common.to_pickle(_unsupported_function)
Expand Down

0 comments on commit 5d87ac6

Please sign in to comment.