TJaniF opened a new issue, #48511:
URL: https://github.com/apache/airflow/issues/48511
### Apache Airflow version
3.0.0
### If "Other Airflow 2 version" selected, which one?
current main
### What happened?
Tested pandas dataframe passing through xcom, serialization works,
deserialization fails.
This is the testing dag:
```
from airflow.decorators import dag, task
@dag
def serial_panda():
@task
def my_task():
import pandas as pd
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})
return df
@task
def my_task_2(df):
print(df)
my_task_2(my_task())
serial_panda()
```
my_task_2 fails with:
```
Log message source details:
sources=["/root/airflow/logs/dag_id=serial_panda/run_id=manual__2025-03-28T21:11:17.945583+00:00_FeRP0hFX/task_id=my_task_2/attempt=1.log"]
[[2](http://localhost:28080/dags/serial_panda/runs/manual__2025-03-28T21:11:17.945583+00:00_FeRP0hFX/tasks/my_task_2?try_number=1#2)025-03-28,
21:11:22] INFO - DAG bundles loaded: dags-folder:
source="***.dag_processing.bundles.manager.DagBundlesManager"
[2025-0[3](http://localhost:28080/dags/serial_panda/runs/manual__2025-03-28T21:11:17.945583+00:00_FeRP0hFX/tasks/my_task_2?try_number=1#3)-28,
21:11:22] INFO - Filling up the DagBag from /files/dags/serial_panda.py:
source="***.models.dagbag.DagBag"
[2025-03-28, 21:11:22] ERROR - Exception rendering Jinja template for task
'my_task_2', field 'op_args'. Template:
(XComArg(<Task(_PythonDecoratedOperator): my_task>),):
source="***.sdk.definitions._internal.abstractoperator"
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty,
a.bool(), a.item(), a.any() or a.all().
File
"/opt/***/task-sdk/src/***/sdk/definitions/_internal/abstractoperator.py", line
380 in _do_render_template_fields
File "/opt/***/task-sdk/src/***/sdk/definitions/_internal/templater.py",
line 193 in render_template
File "/opt/***/task-sdk/src/***/sdk/definitions/_internal/templater.py",
line 193 in <genexpr>
File "/opt/***/task-sdk/src/***/sdk/definitions/_internal/templater.py",
line 189 in render_template
File "/opt/***/task-sdk/src/***/sdk/definitions/xcom_arg.py", line
3[4](http://localhost:28080/dags/serial_panda/runs/manual__2025-03-28T21:11:17.945583+00:00_FeRP0hFX/tasks/my_task_2?try_number=1#4)5
in resolve
File "/opt/***/task-sdk/src/***/sdk/execution_time/task_runner.py", line 346
in xcom_pull
File "/usr/local/lib/python3.9/site-packages/pandas/core/generic.py", line
1519 in __nonzero__
[2025-03-28, 21:11:22] ERROR - Task failed with exception: source="task"
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty,
a.bool(), a.item(), a.any() or a.all().
File "/opt/***/task-sdk/src/***/sdk/execution_time/task_runner.py", line 648
in run
File "/opt/***/task-sdk/src/***/sdk/execution_time/task_runner.py", line 588
in _prepare
File "/opt/***/task-sdk/src/***/sdk/execution_time/task_runner.py", line 253
in render_templates
File "/opt/***/task-sdk/src/***/sdk/bases/baseoperator.py", line 1550 in
render_template_fields
File
"/opt/***/task-sdk/src/***/sdk/definitions/_internal/abstractoperator.py", line
380 in _do_render_template_fields
File "/opt/***/task-sdk/src/***/sdk/definitions/_internal/templater.py",
line 193 in render_template
File "/opt/***/task-sdk/src/***/sdk/definitions/_internal/templater.py",
line 193 in <genexpr>
File "/opt/***/task-sdk/src/***/sdk/definitions/_internal/templater.py",
line 189 in render_template
File "/opt/***/task-sdk/src/***/sdk/definitions/xcom_arg.py", line
34[5](http://localhost:28080/dags/serial_panda/runs/manual__2025-03-28T21:11:17.945583+00:00_FeRP0hFX/tasks/my_task_2?try_number=1#5)
in resolve
File "/opt/***/task-sdk/src/***/sdk/execution_time/task_runner.py", line 346
in xcom_pull
File "/usr/local/lib/python3.9/site-packages/pandas/core/generic.py", line
1519 in __nonzero__
```
### What you think should happen instead?
In Airflow 2.10 the same dag/ task works:
```
[2025-03-28, 21:22:17 UTC] {logging_mixin.py:190} INFO - a b
0 1 4
1 2 5
2 3 6
[2025-03-28, 21:22:17 UTC] {python.py:240} INFO - Done. Returned value was:
None
```
### How to reproduce
Run the dag above, look at the logs of my_task_2.
### Operating System
MacOs
### Versions of Apache Airflow Providers
None
### Deployment
Other
### Deployment details
Breeze
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]