빅데이터(BigData)/Spark

Koalas에서 Cannot combine the series or dataframe because it comes from a different dataframe 에러 발생 시

leebaro 2021. 3. 15.
728x90

pyspark에서 koalas를 이용해서 DataFrame을 사용하는 작업에서 아래와 같은 에러를 만날 수 있다.

 

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.

이 경우 에러 메시지에도 나와있는 옵션을 아래와 같이 추가하면 된다.

from databricks.koalas.config import set_option, reset_option
set_option("compute.ops_on_diff_frames", True)
kdf['C'] = kser
# Reset to default to avoid potential expensive operation in the future
reset_option("compute.ops_on_diff_frames")
kdf

 


참고

databricks.com/blog/2020/03/31/10-minutes-from-pandas-to-koalas-on-apache-spark.html

728x90