Hello all, I'm using a venv of python 3.9.13 and a requirements.txt in my project:
...
pandas 2.0.0
plotly 5.14.1
..
Two codes parts works locally but not on Posit Connect:
df = scope[["ID"] + [what]].groupby(["ID"]).nunique()
df["Share"] = df.groupby(
level=0,
as_index=False,
).apply(lambda x: round(100 * x / float(df[what].sum()), 2))
This part return locally the percentage and NaN on Posit Connect...
data = (
data[["ID"] + [what, level]]
.groupby([what, level])
.nunique()
)
This return Error: incompatible index of inserted column with frame index (impossible to have multiple index).
In the log ONLY on Posit Connect, error is: ValueError: operands could not be broadcast together with shapes (2782,2) (3,) (2782,2).
It's possible the error is related to the python version on Posit Connect (3.10.6). However, if I use this version locally in place of 3.9.13, it works correctly. Anyone knows why? Thanks all!