App working locally but not on streamlit server

My app was working perfectly fine months ago and still works fine when I host it locally but now I see this bug I can’t solve. Has anyone encountered this and have a fix for it?:

TypeError: can only concatenate str (not "float") to str
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/", line 332, in _run_script
    exec(code, module.__dict__)
File "/mount/src/recipescraper/", line 269, in <module>
    df_download = create_df(recs)
File "/mount/src/recipescraper/", line 213, in create_df
    res['Total'] = res.drop(['Ingredients', 'Measurement'], axis=1).sum(axis=1)
File "/home/adminuser/venv/lib/python3.9/site-packages/pandas/core/", line 11315, in sum
    result = super().sum(axis, skipna, numeric_only, min_count, **kwargs)
File "/home/adminuser/venv/lib/python3.9/site-packages/pandas/core/", line 12055, in sum
    return self._min_count_stat_function(
File "/home/adminuser/venv/lib/python3.9/site-packages/pandas/core/", line 12038, in _min_count_stat_function
    return self._reduce(
File "/home/adminuser/venv/lib/python3.9/site-packages/pandas/core/", line 11207, in _reduce
    res = df._mgr.reduce(blk_func)
File "/home/adminuser/venv/lib/python3.9/site-packages/pandas/core/internals/", line 1459, in reduce
    nbs = blk.reduce(func)
File "/home/adminuser/venv/lib/python3.9/site-packages/pandas/core/internals/", line 377, in reduce
    result = func(self.values)
File "/home/adminuser/venv/lib/python3.9/site-packages/pandas/core/", line 11139, in blk_func
    return op(values, axis=axis, skipna=skipna, **kwds)
File "/home/adminuser/venv/lib/python3.9/site-packages/pandas/core/", line 85, in _f
    return f(*args, **kwargs)
File "/home/adminuser/venv/lib/python3.9/site-packages/pandas/core/", line 404, in new_func
    result = func(values, axis=axis, skipna=skipna, mask=mask, **kwargs)
File "/home/adminuser/venv/lib/python3.9/site-packages/pandas/core/", line 477, in newfunc
    return func(values, axis=axis, **kwargs)
File "/home/adminuser/venv/lib/python3.9/site-packages/pandas/core/", line 646, in nansum
    the_sum = values.sum(axis, dtype=dtype_sum)
File "/home/adminuser/venv/lib/python3.9/site-packages/numpy/core/", line 49, in _sum
    return umr_sum(a, axis, dtype, out, keepdims, initial, where)

Hey @jrodriguez5909,

It looks like the app is working – are you still seeing this issue?

If you try running the links in the text box do you get a print of the dataframe?

Yes I was able to reproduce the error by doing that. It looks like you were using the Pandas append method which was deprecated (the error is probably not showing locally due to an earlier version of Pandas being used on your local machine). It looks like concat is the more current version of that method; I’d recommend trying to use that method instead.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.