Skip to content

Python, “print” and “return” resulted in different boolean logic

I recently started learning python through Sololearn and got to Recursion. To get better understanding of the code, I simplified it to: The return not is_even(x) is boolean and will resulted it as False and when it passed to the def is_even(x): it still would return as False. However, when I change the return…

Splitting Dataframe into different group by product

I am trying to split my Dataframe such that each Dataframe is for a product. Given below is how my Dataframe looks like: Expected output: Dataframe for prod_a Dataframe for prod_b Dataframe for prod_c Answer I suggest here create dictionary of DataFrames in dictionary comprehension: Variables from strings are…

flask web socket not connecting

i am trying to connect websocket in flask(1.1.2) with Flask-SocketIO(5.0.1) but it give 400 error to websocket url. i`m using anaconda virtual environment. my requirements.txt is – amqp==5.0.3, bidict==0.21.2, certifi==2020.12.5,click==7.1.2, dnspython==1.16.0, eventlet==0.30.0, Flask==1.1.2, Flask-Sock…

Discord.py editing channel by word that is in the name

I am making statistics bot, and i have a problem, with voice channel containing member count. I want to make bot update name of that channel, on_member_join, on_member_remove and when user use command refresh but i tried many times at different ways, and it stil don’t work, i want to make him edit chann…

SettingWithCopyWarning, how to stop it?

I have this code, it’s working for the first 9 itterations and then I get the SettingWithCopyWarning and it doesnt continue on, what can I do? So I have this now, but it still only runs through the first 10 lines of data! Something to do with the first for loop I think! (I know it’s still a for lo…