Category "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

How to go through all Pydantic validators even if one fails, and then raise multiple ValueErrors in a FastAPI response?

Is it possible to call all validators to get back a full list of errors? @validator('password', always=True) def validate_password1(cls, value): password =

Cannot install Python 3.7 on osx-arm64

I am trying to create a new environment with Python 3.7 using Conda like: conda create -n qnn python=3.7 I got following errors: Collecting package metadata (

Trying multiprocessing but the program dies before it even starts

I have this code: from multiprocessing import Process, cpu_count def readplayerinfo(): y=0 Gameon = True while Gameon: y+=1 print('

How to move desktop icons with python?

I am making a python program that moves the desktop icons using LVM_SETITEMPOSITION from winapi but I have a problem with commctrl.LVM_SETITEMPOSITION and it gi

Object is not subscriptable python error django

I have this function where i am using models 'Start' and 'End' that contain fields latitude and longitude.. and I am trying to match them with a field called el

How can I add users in a private room with a command when they are mentioned?

I am creating a command and in this command when I run it, it has to create a room and add the people mentioned. Instead, it adds the user who used the command.

google-cloud-resource-manage list projects 403 The caller does not have permission

I created a GCP service account and assigned the needed permissions for listing the projects inside the organization. When I'm using the gcloud cli, everything

Error in executing YOLO .txt annotations to .csv converter

I'm having trouble executing this file. Given that I'm working on a multi-class classification, each .txt file has several lines addressing each object in every

How can i find selected area in photo using OpenCV?

I need to detect a selected area in a photo: Original photo: I used this code: import cv2 as cv import numpy as np img = cv.imread(cv.samples.findFile('./Pict

In openpyxl, is there a way to see what conditional formatting rule(s) are applied to a cell?

I'm using openpyxl 2.5.6 and py 3.7.0. My goal is to read an Excel workbook and print both the contents and the formatting of each cell into a CSV. For instance