Category "python"

Convert pdf to docx and vice versa without breaking the format of file

I tried few ways to convert the pdf file to docx or docx to pdf file . I tried via python and its working too . But the format breaks suppose the pdf file has t

Multi input problem Keras. Expected to see 2 array(s), but instead got the following list of 1 arrays

I have a model that takes two inputs of the same shape (batch_size,512,512,1), and predict two masks each of shape (batch_size,512,512,1). dataset_input = tf.da

Entry-wise domination of vectors

I have several list of reals in [0,1] of identical size. For instance: [0.33, 0.0, 0.0, 0.33, 0.33, 0.33, 0.0] [0.0, 0.33, 0.0, 0.33, 0.33, 0.33, 0.0] [0.0, 0.3

Downgrade Python version in virtual environment

I am always getting the same error regarding TensorFlow: ModuleNotFoundError: No module named 'tensorflow.contrib'. I am actually using Python version 3.9 but,

Merkle Proof in python using Keccak256

I'm trying to create a whitelist for an NFT using a Merkle tree to save on gas costs. I saw a great implementation here, in javascript, but I would like to do

name 'DiracDelta' is not defined in calculating the hessian

I'm working on a project and trying to calculate the gradient and the hessian using this symbolic library but I'm getting an error NameError: name 'DiracDelta'

ModuleNotFoundError: pandas 1.3.5 with pyinstaller 4.10

I'm trying to compile a python script using pyinstaller and pyinstaller says " 10230 INFO: Building EXE from EXE-00.toc completed successfully" but when I execu

Why my Spark mapPartition function is being slowed?

My algorithm is simple: I am using Spark to distribute the processing of a process that runs a cross-validation in Python. I have 3 workers and all I do is assi

bson.errors.InvalidDocument: cannot encode object of object having list of Object

I have a class defined in below form class B(): xyz: int class C(): abc: int Class A(): bList: List[B] cList: List[C] iex : int MongoDb Save Operation

Solving "CUDA out of memory" when fine-tuning GPT-2 (HuggingFace)

I get the reoccuring CUDA out of memory error when using the HuggingFace Transformers library to fine-tune a GPT-2 model and can't seem to solve it, despite my

python selenium xpath loop skips random elements

I was trying to select all the 264 Recipients from the second form on this website and I used the code below: s = Service('./chromedriver.exe') driver = webdriv

Python - Scraping API and Transform Json Data to CSV

My experience: Just started with Python and no developer My Goal: Trying to scrape Sofascore API for getting Soccer Lineups to CSV. The json data need to be tra

Not able to install django-allauth in ubuntu 18.04.6 LTS

I'm trying to add social authentication in my project but when I try to install django-allauth it is giving me error I've tried this post but no luck it's givin

Combing concurrent.future.as_complete() with dictionary using zip()

I am a first time user of concurrent.futures and following the official guides. Problem: Inside the as_completed() block, how do I access the k, v which is insi

Cannibals and missionaries problem python -artificial intelligence algorithm

I'm trying to solve the cannibals and missionaries problem in python (with some additional criteria, but the main idea is the classic one). So, in the class Gra

python how to use string value for custom sort?

I have an datafremae like this time_posted 0 5 days ago 1 an hour ago 2 a day ago 3 6 hours ago 4 4 hours ago I tried this df.sort_values(by='time_p

How to read text from an image and save it to a text file

I used image_path= "image.jpg" reader = easyocr.Reader(['en'], gpu=False) result= reader.readtext(image_path) print(result) print("text printed") output: Using

Problem in changing directory with a path variable in google colab

I want to change directory in google colab. a = 'drive/MyDrive/COLAB/colab_common_utilities' Following works: # method 1: import os os.chdir('drive/MyDrive/COLA

Visual Studio Code freezes after short while "The window is not responding"

Problem: I can open VS code and start typing but after ~30s (sometimes minutes) the window freezes showing this message: I am using python on a jupyter noteboo

ModuleNotFoundError: No module named 'faker'

I am trying to install faker package and I got a message that is successfully installed But when trying the code from faker import Faker, I got a message Module