Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-36265][PYTHON] Use __getitem__ instead of getItem to suppress …
…warnings ### What changes were proposed in this pull request? Use `Column.__getitem__` instead of `Column.getItem` to suppress warnings. ### Why are the changes needed? In pandas API on Spark code base, there are some places using `Column.getItem` with `Column` object, but it shows a deprecation warning. ### Does this PR introduce _any_ user-facing change? Yes, users won't see the warnings anymore. - before ```py >>> s = ps.Series(list("abbccc"), dtype="category") >>> s.astype(str) /path/to/spark/python/pyspark/sql/column.py:322: FutureWarning: A column as 'key' in getItem is deprecated as of Spark 3.0, and will not be supported in the future release. Use `column[key]` or `column.key` syntax instead. warnings.warn( 0 a 1 b 2 b 3 c 4 c 5 c dtype: object ``` - after ```py >>> s = ps.Series(list("abbccc"), dtype="category") >>> s.astype(str) 0 a 1 b 2 b 3 c 4 c 5 c dtype: object ``` ### How was this patch tested? Existing tests. Closes #33486 from ueshin/issues/SPARK-36265/getitem. Authored-by: Takuya UESHIN <ueshin@databricks.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
- Loading branch information
1 parent
a1a1974
commit a76a087
Showing
4 changed files
with
5 additions
and
5 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
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
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