Category "python"

Apply a weighted decay that changes over time in Python

I have a dataframe in Python that looks like the one below: I want to calculate the dnf_rate_weighted so that there's a 0.95 decay for each stage going back th

How to randomize shapes and colors using turtle python?

Can someone please help me with drawing random shapes in random colors using turtle python?

How to run Django admin site on Android

This is what am facing with with Django on my Android I'm using Pydroid on my phone. Python and Django are fully functional. But when I try to run Django admin

source to source transformation

I would like to transform input.js to output.js using string manipulation in python here is input.js let k=document.createElement("div"); k.innerHTML='<style

How to create a Dataframe from multiple dictionaries

I have a little issue with my the data I have (multiple dictionaries) to process and create a Dataframe from them. This what the data look like: print(data) 0

Handling this website which is redirecting to the same url with BeautifulSoup

So I'm scrapping this website: https://www.hepsiburada.com/apple-macbook-pro-m1-cip-8gb-256gb-ssd-macos-13-qhd-tasinabilir-bilgisayar-uzay-grisi-myd82tu-a-p-HBV

Facetgrid Formatting and sorting each graph

Below is the code I've created to run the facetgrid graph. As you can see, merged1 is the first dataframe and merged2 is the second dataframe I am iterating on.

how to use keygen.sh API for python

really sorry I am a noob coder trying to make it so users need to have entered a license key that gets stored on the local computer & checks the policy from

PyQT5 and OpenCv2 loading images incorrectly when refreshing

In a nutshell, I currently am trying to load a picture and view it using pyqt5, via QtWidgets.QGraphicsScene. However, after loading the picture, I run some ope

How to find image with its source in python markdown2

I am trying to make a static site generator with Python. I coded most of it. But there is a problem. When I add an image to a Markdown file (like this: ![Python

Difference between excel's and python R2, Power fit

I'm trying to do a power fitting of the x and y arrays and estimate also the R2. I have already done it with excel and it gives me an R2 of 0.5389 while if I ru

Load item description from json file

Recently i saw a post about someone making a program that could control a computer it was launched on. (it was this one) Add commands to user input I was really

Panda dataframe replace() method for row numbers

I need to replace some values in a column with a specific value using the row numbers list of the required values as an array like following array.Can I use dat

Hi there, I am trying to find the max consecutive ones but python throws an error

I have tried to implement this code but python just blocks me by saying that ValueError: The truth value of an array with more than one element is ambiguous. Us

Create python function from script

Struggling to get this code to work as a function. It needs to separate values within a particular field which contains + symbols and create a new row which has

How to connect to postgres on another server where postgres is on docker?

I can connect to postgres in that way. On my local machine i run: ssh name@ip -p 22 input --> password and then sudo docker-compose exec postgres bash afte

Python patch returning magicmock instead of return value

I have this code import cv2 from src.utilities.binary import message2binary from src.utilities.stegUtils import verify_payload def encode(input_path: any, paylo

How to plot Acutal and predictions in python (While 0 and 1)

How to plot the Acutal vs Prediction graph in python. It's was 0 and 1 values so plot is not meaningful.

Django can't save userprofile instance during saving forms

I am getting this error Cannot assign "<QuerySet [<UserProfile: UserProfile object (131)>]>": "BlogComment.userprofile" must be a "UserProfile" ins

Converting the values of the dictionary in to a file in Python

I have a dictionary say : my_map_dict which looks something like below: {2: [['1', '2', '4', '4', '0', '2', '0', '0.67'], ['5', '6', '3', '8', '0', '2', '1', '0