Category "python"

Finding a specific shape position in the Image

I want to Finding a specific shape position in the Image. Firstly, I have a main image like below and I have multiple icons like below. I want to find the posit

How to fetch data that is in JSON format from an API using python to a .db file

I have an API: https://baseballsavant.mlb.com/gf?game_pk=635886 I want to fetch the data from here (which is in JSON format) using a python code and create a ta

Why pyspark code running in the pycharm generate these information?

I'm a green hand of python and pyspark. When I run the code of pyspark in pycharm, it always generate the information below. I want to know the reason and solut

Generating a Non Linear equation in Python like an excel output

I have some sample data below: Freemium: 0.5, 0.3333 , 0.1666, 0.0466, 0.0466, 0.1, 0.1666, 0.3333, 0.5 Minutes:0, 60, 120 ,180 ,240 ,300 ,360 ,420, 480 I want

Is it possible to use wildcard_constraints to exclude certain keywords from being matched Snakemake?

I have a rule that calculates new variables based on a set of variables, these variables are separated into different files. I have another rule for calculating

How to filter a Django model to display only the logged-in user's data?

Trying to solve this for a week now. How do I filter my model to display only the data assigned to the specific logged-in user? My views.py code below is not wo

Python PIL - Cannot find reference '[' in 'None'

I've been searching answers for this for the past hour and I'm feeling like any already asked question just barely misses my case. I have been tinkering with th

Best way to handle 2 websocket connections in the same time

i am handling data from 2 websocket servers and i would like to know whats the fastest way to handle both connections in the same time given that the 1st connec

Can't launch Spyder after installing with pip

Python beginner here. I would like to use Spyder as my Python IDE. Alas the standalone version does not include pip and I want to work with "Vanilla Python" rat

I want to replace letters/words, but I am facing challenges in one aspect of my code

I will be using lloll as an example word. Here's my code: mapping = {'ll':'o','o':'ll'} string = 'lloll' out = ' '.join(mapping.get(s,s) for s in string.split()

How do I update the ssl certificate when running websocket connection? (Alpaca API websocket)

When I'm running below code, nothing happens even though the code should print "opened" , then "received a message" and print the message from the websocket, wh

Consuming API Workspace for Developers

I'm trying to consume Google's Workspace APIs, but I'm having extreme difficulty with the documentation to create my first code, following the first steps I did

About adding a snippet for python in vs code

How to write a snippet for 'main' function in vs code? It's not allowing to put double "" in between the body. Here is what I have written: "Print to console":

How to create sitemap with dynamic sub sitemap structure in django?

I'm trying create a dynamic generate sitemap in django and i hit the wall. Action I'm trying to code: in url.py i have url: re_path(r'sitemap-jobs.xml$'...) the

Scipy linprog constraints not satisfied

I’ve defined a linear programming model using scipy linprog however the equality constraints when I calculate them manually do not satisfy the constraint.

RuntimeError: The expanded size of the tensor (1300000) must match the existing size (80) at non-singleton dimension 0

I have following errors in my RBM code and here is the in raw. ipykernel_18388/119274704.py in v_to_h(self, v) 23 24 p_h = F.sigmoid( ---

Use diffie hellman key exchange algorithm to encrypt and decrypt files in python

I want to implement an algorithm which will encrypt and decrypt files using diffie hellman algorithm but I am unable to find any solution for the same. Here is

O(log n) algorithm in theory runs much slower in practice

The algorithm is for calculating 2^n recursively. I have used the Master theorem to determine that the time complexity is indeed O(log n) which seems to correct

Problem creating dll and loading then in Python ctypes

I want to learn to create DLLs in c++ and use them in python to increase the speed of calculations. To begin with, I tried to create a simple C++ dll and load

Multiple optional command parameters with discord.py

I was looking at asking for multiple optional parameters with discord.py, although I'm not sure how to do it. This is my example, although I'm pretty sure it's