Quantcast
Channel: Active questions tagged python - Stack Overflow
Browsing all 13921 articles
Browse latest View live
↧

Loop in a list of dataframes

For now, I have this code, and it works, but I know that I can use a for loop to make the code more efficient and readable. However, I'm struggling with the implementation.first = pd.DataFrame()second...

View Article


Pymeshlab claiming files are not present when they are?

I have two pymeshlab scripts:import osimport argparseimport pymeshlabfrom collections import Counterdef load_mesh(file_path): ms = pymeshlab.MeshSet() ms.load_new_mesh(file_path) measures =...

View Article


Scraping indicator results from tradingview - steps and instructions

Before you deem this question duplicated, I read all the questions with the topic of scraping and tradingview, none of those question covered the points here completely, so I asked my own question....

View Article

How to handle exceptions for all the sub apps in FastAPI

I have a FastAPI project containing multiple sub apps (The sample includes just one sub app).main_app = FastAPI()class CustomException(Exception): def __init__(self, message: str, status_code: int,...

View Article

How to protect Python using VMProtect sdk? [duplicate]

Closed. This question needs details or clarity. It is not currently accepting answers.Add details and clarify the problem you’re solving. This will help others answer the question. You can edit the...

View Article


Password validation with pydantic

To avoid using if else loop, I did the following for adding a password validation in pydantic @field_validator("password") def check_password(cls, value): # convert the password to a string if it is...

View Article

Installation Failure with Stream Diffusion

Commands I have tried:python -m streamdiffusion.tools.install-tensorrtError generated by the above command:Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com,...

View Article

openpyxl load workook only after i save workbook manually

I am trying to remove a sheet in work book but get a Error, i notice that i have to manually open that file save it and then it load correctly.from openpyxl import load_workbookdef...

View Article


Pdf password protection using Python

I am trying to password protect a pdf file using python.I have come across a solution using PyPDF2 library but the solution does not work on the version of 3.0.0 or above.Below is the code# import...

View Article


Get page with requests without response or status code

I use the following source code:import requestsurl = "https://www.baha.com/nasdaq-100-index/index/tts-751307/name/asc/1/index/performance/471"web = requests.get(url)print(web.status_code)url =...

View Article

Python return image to http request

I setup python in iis with handler "c:...\python.exe %s %s" for *.py. Then want to provide url like "https://.../getpng.py?no=1" to return image stream to html as below<img...

View Article

Read Fastq file directly into Pandas Dataframe

I'm trying to read a Fastq file directly into a pandas dataframe, similar to the link below:Read FASTQ file into a Spark dataframeI've searched all over, but just can't find a viable option.Currently,...

View Article

Pandas to_datetime method giving incorrect year when converting Unix Timestamp

When using to_datetime method of Pandas Dataframe to convert a Unix Timestamp to a Formatted DateTime in a column of data collected from a Data Logger I get the wrong year by 20 years. I have checked...

View Article


tkinter treeview background color issuse

I was creating a password manager in python using Tkinter and Customtkinter libraries. To be able to view all the passwords I decided to use treeview method but im unable to configure its background...

View Article

Does FastAPI websocket example deadlock the process?

The code in the docs has a while True: block and I am curious if something like that would deadlock the process. If I get two requests, would the second one just not go through? why or why not?Source:...

View Article


I m not able to send Json data to Django views.py , im trying Ajax for this...

I'm facing an issue with CSRF verification in a Django project when making an AJAX POST request. Here's a simplified version of my code:**registration.html ***<form method="POST" onsubmit="return...

View Article

How can I maintain an async CosmosDB connection pool in a FastAPI app?

I have a FastAPI app that uses the azure-cosmos library to store data in a CosmosDB. I'm expecting to have a ton of traffic, so I want to create a pool of async CosmosDB clients.Is that something the...

View Article


Transformers(Pytorch) how to resume train when out of memory?

I am using BertModel for training in Transformers. I want to change max_length in mini-batch training. but this leads to OOM(Out of memory). The reason is that the constant tensor created in BertModel...

View Article

Running python through fastCGI for nginx

I am looking to run standalone python scripts through fcgi for use with nginx, but I have no idea where to start with spawning the processes. Currently, I have PHP successfully with nginx+fcgi, but I'm...

View Article

Why the CNN model is not trained? [closed]

I am trying to train a CNN model in Matlab to predict the mean value of a random vector. To further clarify, I am generating a random vector with 10 components (using rand function) for 500 times....

View Article
Browsing all 13921 articles
Browse latest View live