I am trying to visualize a DICOM file with Python 3 and pyDicom which should contain a black 100×100 image with some curves drawn in it. The pixel data is extracted from header (7fe0,0010) and when printed shows b’x00x00x00…’. This I can easily convert to a 100×100 numpy array. How…
Django json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I’m tyring to use the django login functionality, but ever since i added the login and sign_up route, I started getting this error. Anytime i try to access the sign_up or login route, I kept getting this error…json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) I don’t un…
Python fails to recognize a digit
I have an input file such as this and the program removes everything but the hindi text. Here is my program and the expected output is below However, my program doesn’t recognize the first line digit, and instead it returns Why does this program doesn’t recognize the digit when I specifically wrot…
Error “email has no attribute encode” sending email in python
I am trying to send an email using MIME in python. Below is the code I am using : but its giving me the below error: module email has no attribute encode at line: s.sendmail(“xyz@gmail.com”, recipients, msg.as_bytes()) I am not able to understand why its giving this error. I have tried only using …
Is there a smtp client included in Databricks platform to be able to send emails?
How can you send an email from a Databricks platform? I would like to send an email from a notebook in Databricks with Python. I’m wondering if there’s already an SMTP client already configured that I can use. I tried to do it, but didn’t succeed. Answer The answer is “no”. There…
Authenticating Azure CLI with Python SDK
I am writing some functions to extract data from Azure. I am using the Python subprocess library with the Azure CLI commands as they are easier and better documented thank the Python SDK. My question comes whether it is possible to combine the Azure CLI commands with the Python SDK to make the authentication …
When I read a csv with squeeze is set to True in Pandas it makes dataframe not series
Was able to import a CSV while trying to perform squeeze but it looks like a data frame instead of a series? This is what I tried this is what I expected at least I remember learning the output was not a data frame but more like a series? I was expecting it would come in like a series and
Architecture Flask vs FastAPI
I have been tinkering around Flask and FastAPI to see how it acts as a server. One of the main things that I would like to know is how Flask and FastAPI deal with multiple requests from multiple clients. Especially when the code has efficiency issues (long database query time). So, I tried making a simple cod…
For loop is several times faster in R than in Python using the rpy2 library
The following simply for block takes about ~3 sec to complete in R: The same code run in Python through the rpy2 library takes between 4-5 times more: Is this just because I’m using the rpy2 library to communicate with R or is there something else at play? Can this be improved in any way (while still ru…
How to set options for chromium Edge() in Selenium?
I have been following tutorials, and I came up on Firefox, and using Options(), I could set headless mode while defining browser (browser = Firefox(options=opts)), but for Firefox only. I downloaded the driver for the new chromium Edge, but I cannot seem to set the options= keyword in Edge(). Can anyone tell …