Category "python"

Fastest way to remove white background from image/video

I need to make the below faster as I need it to run on a video. Basically I am trying to remove a white background on a video and then overlay that onto another

Updating database after reordering Datatable

I'm struggling with the datatables reordering. I want when user reorder to update table in the database. For this to happen i need: to configure the datatable t

Some one can explain to me how this code executes ? I still mess up with recursion

That output is supposed to be 4,3,2,1 right? def test(x): if x > 0 : test(x - 1) print(x) test(4) #output => 1 #output => 2 #output => 3 #outp

automatically remove items of a list every few second in redis

I'm trying to see how many users used my bot in the last 5 minute. I've got an idea to every time a user used my bot I add his/hers id into a redis list with a

run function file in google colab

In Google Colab, how can I execute the function file related to the original code? In the main code is part of the function that is in the file. PY is another,

Extracting rows from list in data frame where at max numbers [duplicate]

So i've been given a pandas data frame and created a definition for the maximum variable in one column. max_energy = D202['USAGE'].max() max_e

matrix with nodes that refer to which openings/connections they have

I would like some help on a problem that has been stressing me for a while now It revolves around recurdive backtracking maze generation, but should reurn a mat

How to make ball bounce off of triangle in Py.Processing?

Im building a game in processing python. It is similar to pong except the paddles can rotate thus changing the direction of the ball. There is also supposed to

How can I plot a pandas dataframe where x = month and y = frequency of text?

I have the following dataset: Date ID Fruit 2021-2-2 1 Apple 2021-2-2 1 Pear 2021-2-2 1 Apple 2021-2-2 2 Pear 2021-2-2 2 Pear 2021-2-2 2 Apple 2021-3-2 3 Apple

Add elements in a list at the n index of a other list

calibres_prix =['115-135', '1.87'], ['136-165', '1.97'], ['150-180', '1.97'], ['190-220', '1.97'], ['80-95', '1.42'], ['95-115', '1.52'], ['150-180', '1.82

TypeError: forward() missing 1 required positional argument in a method

I use the following model: model = DeepGraphInfomax(128, pos_summary_t).to(device) which looks like: class DeepGraphInfomax(torch.nn.Module): def __init__(s

Installing python package from private gitlab repo in Dockerfile

I'm currently trying to install python packages from a private gitlab repo. Unfortunately, I get problems with the credentials. Is there any way to install this

How to get conf value from airflow dag?

I want to get conf value from dag area. "{{ dag_run.conf['company'] }}" is recognized as a string. How can I get this value? Values ​​are passed fin

Python, typeerror about string and bytes

I used Youtube API and got list of comments. And trying to change it into single string so I can use konlpy. a = str(' '.join(c)).encode("UTF-8") But I got

How to Make Keypresses Using PyAutoGUI

I am using PyAutoGUI to try to code a macro. For this macro, I need to press a key to select something. To interact with the screen, I am using PyAutoGUI. Any i

Evaluating Dots and Noise in an Image

I have an image that consists of small black dots, and in each dot's vicinity there is some noise that appears as grayish smudge. I'm trying to use some sort of

I want to create a profile for every user that is registered. I am using dj-rest-auth for authentication

models.py from django.db import models from django.contrib.auth.models import User Create your models here. class Profile(models.Model): user = mode

How do I structure if-statements for maintainability?

I have a package for a very specific purpose that is imported into many other systems and it consists of a lot of if statements. Is there a way of rewriting the

simple-salesforce bulk query takes hours for a simple soql

My bulk query has been taking hours in production today. Before this, it takes only a few minutes. Just wondering what might be the issue? This takes 2 hours (T

403 Forbidden error when getting cat images

I just finished programming a dog photo program, and after a few issues it works fine. I decided to make a modified version that uses a different api to give ca