Hi I received an error message about ‘<=’ not supported between instances of ‘DeltaGenerator’ and ‘float’. Below is my code. There is only float in BMI comparing INDEXp. There is no string. Not sure why it doesnt work. Please assist
@AliceKoh Thank you for printing them but can you print them inside the streamlit script. I want to see the type of variables before it gives an error.
Maybe something part of the code is changing the type of these variables.
HI gaganmanku96,
Oh I am using sublime text and jupyter. May I know what is the name of the software that I can type streamlit script ? I will download and try
Hi gaganmanku96,
Are you referring to this where I got it from the error message (pink)?
File "C:\Users\alice\anaconda3\lib\site-packages\streamlit\scriptrunner\script_runner.py", line 557, in _run_script
exec(code, module.__dict__)File "display.py", line 108, in <module>
main()File "display.py", line 64, in main
if BMI<=INDEXp[0]:
HI I tried to use another method but also encounter error. I really hope someone can help with this as if elif else statement with value is a very common yet powerful statement. I feel that I am handicap without this function. Please assist. Thanks.
File "C:\Users\alice\anaconda3\lib\site-packages\streamlit\scriptrunner\script_runner.py", line 557, in _run_script
exec(code, module.__dict__)File "display.py", line 143, in <module>
main()File "display.py", line 140, in main
rpt_bmi(BMI,fname)File "display.py", line 46, in rpt_bmi
cal_bmi(BMI)File "display.py", line 17, in cal_bmi
if BMI <Index_BMI[0] or BMI ==Index_BMI[0]:
I’ve read through this thread and it’s difficult to see what your problem is exactly. On the one hand you’re talking about Jupyter and on the other hand saying you wish to run that app in Streamlit. The two platforms are quite different and apps for each one are built differently. Also the code snippets you have shown are incomplete / incorrect. Anyhow, I figured you’re building a BMI calculator and since I’m trying to lose weight I thought I’d experiment with your code to make it work in Streamlit.
Hi Arvindra,
Thank you for helping. Your BMI calculator looks nice. May I know how did you define with outside_display_area: ? I try to run the code but it says need to define.
Please see the code on GitHub. There are a couple of lines of code not displayed with with echo(), including the streamlit import. I renamed outside_display_area to outside_expander_area, which is more accurate.
import streamlit as st
outside_expander_area = st.container()
with st.expander('Show the code', expanded=True):
with st.echo():
...
... The rest of the code here ...
...
thanks for your assistant. I manage to use the if-elif-else statement now as per your help. Your meter is cool, maybe someday I am going to make one but not now as might be a bit technical for me. So I complete mine in a cheating way…ha ha ha…
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.