quadratic icon indicating copy to clipboard operation
quadratic copied to clipboard

bug: `cells(...)` returns coroutine without pandas df functionality

Open N-Demir opened this issue 1 year ago • 1 comments

Tried searching for a duplicate issue. I noticed

vals = cells((0,0), (0, 1)).iloc[:, 0]

leads to the error AttributeError on line 1: 'coroutine' object has no attribute 'iloc'

while

vals = cells((0,0), (0, 1))
vals.iloc[:, 0]

works fine.

Example: https://app.quadratichq.com/file/c44881a5-b2c3-465c-b97a-0f73aa7ab101

N-Demir avatar Feb 21 '24 01:02 N-Demir

Agreed, I hit upon this same issue very early in my use of quadratic. In my case, it was

x = getCells((a,b),(c,d))[0]

that failed, but

x = getCells((a,b),(c,d))
x = x[0]

that succeeded. These look like 100% equivalent Python code, so it's rather a mystery why one behaves differently (and luck if you manage to figure it out). Most Python users don't know what a coroutine is. Since getCells() is one of your core routines, you can expect that this might show up for many users.

nathancarter avatar Apr 29 '24 19:04 nathancarter