zhengruifeng opened a new pull request, #37768:
URL: https://github.com/apache/spark/pull/37768
### What changes were proposed in this pull request?
Make `ps.DataFrame(data, index)` support the same anchor
### Why are the changes needed?
before:
```
In [1]: import pyspark.pandas as ps
In [2]: psdf = ps.DataFrame([[1,2], [3,4]], columns=["A", "B"])
In [3]: ps.DataFrame(data=psdf[["A"]] * 2, index=psdf.index)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
...
ValueError: Cannot combine the series or dataframe because it comes from a
different dataframe. In order to allow this operation, enable
'compute.ops_on_diff_frames' option.
```
after:
```
In [1]: import pyspark.pandas as ps
In [2]: psdf = ps.DataFrame([[1,2], [3,4]], columns=["A", "B"])
In [3]: ps.DataFrame(data=psdf[["A"]] * 2, index=psdf.index)
A
0 2
1 6
```
### Does this PR introduce _any_ user-facing change?
yes, DataFrame creation now support same anchor
### How was this patch tested?
added UT
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]