while running this program I am getting the error “TypeError: ‘str’ object is not callable”. Any ideas? Answer There are a couple of problems with the posted code. First, the call to caesar_encrpyt() needs to look like caesar_encrypt(s, step). Secondly, you have two local variables in …
how to convert normalized coordinates to pixel coordinates?
what is the most effective way to translate from normalized coordinates (x = 0,1) (y = 0,1) to pixel coordinates (x = 0, 1920) (x = 0, 1080) or is there even a way to do it inside python? i have no idea where to even start. cause im trying to get coordinates from mediapipe’s pose detection module, then …
Pytube: urllib.error.HTTPError: HTTP Error 410: Gone
I’ve been getting this error on several programs for now. I’ve tried upgrading pytube, reinstalling it, tried some fixes, changed URLs and code, but nothing seems to work. and this is the error code: Answer Try to upgrade, there is a fix in version 11.0.0:
Set an optional endpoint parameter dynamically
What is the best way to set an optional endpoint parameter dynamically? Naively, I have tried with activated_on: Optional[date] = Depends(date.today) thinking FastAPI would call the callable, but it doesn’t work. Answer TL;DR Change the callable of your Depends to a helper function, and inject the optio…
validation-remove currency symbol from price
I have this one string, which is actually price, this price value comes with any currency symbol (currency_list), I am trying to remove these currency symbols from price and return only price. Till now I am able to do it for prefix and suffix currency symbol using below code , everything works till here. I ju…
unable to show success page after completion of payment
i am using razorpay payment gateway web integration for my learning eccomerce project everyhing work fine payment can be done all i want is to store some information after payment done in my order model using test mode my views.py for checkout so what the error is after payment completion i want to show html …
How to read a sequence of files as one file (fileinput lacks read)?
I need to read a sequence of files and fileinput seemed just what was needed but then I realized it lacks a read method. What is the canonical way (if any) to do this? (Explicit catenation will be wasteful.) Is there a known technical or security reason that fileinput does not support read? This related quest…
Why my “Elif” isn’t working in this code?
When i run the code my “Elif” dont print anything at the terminal. The code just continues as if nothing is written inside the “elif” quote Im new to coding and i tried for so much time to correct this error but i just couldn’t :( Answer This is because the range is always empty …
best way to iterate through elements of pandas Series
All of the following seem to be working for iterating through the elements of a pandas Series. I’m sure there’s more ways of doing it. What are the differences and which is the best way? Answer TL;DR Iterating in pandas is an antipattern and can usually be avoided by vectorizing, applying, aggrega…
setting columns in multiindex pandas
I have this pandas df which i imported from a csv: Is it possible for everything on the left to be grouped under fresh and everything on the right of the dates to be under column spoil in multiindex format. Such as, there is one column which contains [apple, banana, orange]. I want to do this because later wh…