how to write a function with unknown number of input in python? [duplicate]
I would like to write a function keeping the common index of input dataframes. I could write it as follows for 2 dataframes:def get_df_common_index(df1, df2): common_index =...
View ArticleScraping Text through sections using scrapy
So i am currently using scrapy to scrape a website. The website has n number sublinks which i was able to enter. Each sublink has 3 things i need title, description and content. I am able to get title,...
View ArticleWhy is my exception getting printed twice?
The following code looks good to me, but when I use e0 with my except ValueError it prints twice, please help my slow brainmy inputs are 20.5 and 5try: user_num = int(input()) div_num = int(input())...
View Articlepython- pytorch.compile() giving runtime error saying Dynamo is not supported...
I'm trying to run this block of code in my local LLM.if compile: print("compiling the model") unoptimized_model = model model = torch.compile(model)And this is the error i get:Traceback (most recent...
View ArticleError installing talos for Python in Colab
I need talos for a hyperparameter grid search, and I'm working in google colab.When I run pip install talos in colab I get this error:Collecting talos Downloading talos-1.3-py3-none-any.whl (56...
View ArticleError libgomp.so.1: cannot open shared object file: No such file or directory
I have a service deployed in GLrun (api) that accesses and loads an AI model that is in storage (in a volume created in the container). Testing locally, it works perfectly, even when accessing the...
View ArticleImplement Custom QWidgets as Popup for a QTimeEdit
QTimeEdit has no 'popup' widget and it's overall design makes it "not nice to use".Therefore I coded two custom QWidget classes:class Clock_hourWidget(QWidget): class/object returns/emits first valid...
View ArticleWhy do I get ( Can't parse 'pt1'. ) when running image prcessing algorithm on...
I am trying to run lane detection using hough transform on pythonandI keep getting the follow error:Can't parse 'pt1'. Sequence item with index 0 has a wrong typeon line 47 ,corresponding to this line:...
View ArticleHow to convert Python dataclass to dictionary of string literal?
Given a dataclass like below:class MessageHeader(BaseModel): message_id: uuid.UUID def dict(self, **kwargs): return json.loads(self.json())I would like to get a dictionary of string literal when I call...
View ArticlePython and S3, download the lastest file in a folder [duplicate]
I want to download the lastest file in a folder from a bucket in AmazonWeb services.Right now, i can dowload a file given a specific name.The problem is, in the folder there are several files with...
View Articletensorflow.python.framework.errors_impl.InvalidArgumentError: Graph execution...
HELLO, IAM HAVING THIS EROR, SOMEONE CAN HELP ME. ITS AIN IMAGGE CLASSIFIER,ALREADY CHECK THE NORMALIZATION AND DATA SIZE, IDK WHAT SI THE PROBLEM, IAM USING MOBILENETV2 FEATURE VECTOR FOR THE INPUT...
View ArticleHow can I get the correct output in this program?
(1)Prompt the user to enter two words and a number, storing each into separate variables. Then, output those three values on a single line separated by a space. (2) Output two passwords using a...
View ArticleHow do I handle errors in Ren'py
I'm making a game using Ren'py (based on python) and most errors aren't shown, especially the errors in python code. Is there a possibility to check for possible errors at compile time and how do I get...
View Articlehow to import files from main folder to sub folder?
ps:I am using VS CODE IDEmy project structure isproject--srcold.py--componentsnew.pyThere is a folder named src inside my project folder and inside src there is another folder named componentsNow i...
View ArticleWriting a pandas dataframe with large vector column
I have a pandas dataframe with 4 columns as shown below. The text_vector column contains vectors that are 1500 dimensions:When I write this out using: df.to_csv("./data/train_clean_vec.csv",...
View ArticleI can't find pytorch and cudnn version for CUDA 12.4. Which versions can I...
nvidia-smi output says CUDA 12.4 as follows.I downloaded and installed this as CUDA toolkitand downloaded cudnn top one:There is no selection for 12.4. Because of this i downloaded pytorch for CUDA...
View ArticleTypeError: '_UserObject' object is not callable while running saved mode in...
I'm new to Tensorflow and Python, I'm running custom object detection in Google Colab and following this tutorial -https://github.com/tensorflow/models/blob/master/docs/vision/object_detection.ipynband...
View ArticleI'm having trouble decoding Kernys.Bson
I have a BSON metadata file that appears to have been encoded in Kernys.Bson's format (https://github.com/kernys/Kernys.Bson).The file did not properly comply with BSON's standards.So no other BSON...
View ArticleConverting a text to a dict using a regex with python
Given a text containing nutritional values and other properties of a product, Build a dict, having nutrition names as keys and nutrition values including the unit as dict values.Additifs nutritionnels...
View Articlefast bubble sort
def bubble(lst): swap = 'True' counter = 0 n = len(lst) m = len(lst) while swap == 'True': for j in range(n-1): if lst[j] > lst[j+1]: lst[j],lst[j+1] = lst[j+1],lst[j] counter += 1 swap = 'True'...
View Article