Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cell.run() does not supports dict and dataframe arguments #3299

Open
benbaja opened this issue Dec 27, 2024 · 0 comments · May be fixed by #3300
Open

Cell.run() does not supports dict and dataframe arguments #3299

benbaja opened this issue Dec 27, 2024 · 0 comments · May be fixed by #3300
Labels
bug Something isn't working

Comments

@benbaja
Copy link

benbaja commented Dec 27, 2024

Describe the bug

Hello,
I was planning to use the newest testing feature for my notebook, but unfortunately i'm facing an error when trying to run cells from another notebook dedicated to testing.
Using the Cell.run() function throws a TypeError This cell raised an exception: TypeError('unhashable type: 'DataFrame' / 'dict') when using a pandas DataFrame or a dictionary as one of the kwargs.

Image

Environment

{
"marimo": "0.10.7",
"OS": "Darwin",
"OS Version": "23.6.0",
"Processor": "arm",
"Python Version": "3.13.0",
"Binaries": {
"Browser": "131.0.6778.205",
"Node": "v23.2.0"
},
"Dependencies": {
"click": "8.1.7",
"docutils": "0.21.2",
"itsdangerous": "2.2.0",
"jedi": "0.19.2",
"markdown": "3.7",
"narwhals": "1.18.4",
"packaging": "24.2",
"psutil": "6.1.0",
"pygments": "2.18.0",
"pymdown-extensions": "10.12",
"pyyaml": "6.0.2",
"ruff": "0.8.3",
"starlette": "0.42.0",
"tomlkit": "0.13.2",
"typing-extensions": "4.12.2",
"uvicorn": "0.34.0",
"websockets": "14.1"
},
"Optional Dependencies": {
"altair": "5.5.0",
"duckdb": "1.1.3",
"pandas": "2.2.3",
"polars": "1.17.1",
"pyarrow": "18.1.0"
}
}

Code to reproduce

### notebook.py
@app.cell
def print_col_df(df):
   print(df.columns.tolist())
### test_notebook.py
@app.cell
def imports():
   from notebook import print_col_df
   import pandas as pd
   return (print_col_df, pd)

@app.cell
def test_print_col_df(print_col_df, pd):
   df = pd.DataFrame(data={'col1': [1, 2], 'col2': [3, 4]})
   output, defs = print_col_df.run(df=df)
   assert output == ['col1', 'col2']
@benbaja benbaja added the bug Something isn't working label Dec 27, 2024
@dmadisetti dmadisetti linked a pull request Dec 27, 2024 that will close this issue
@dmadisetti dmadisetti linked a pull request Dec 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant