Category "python"

Convert dog ages to human years

it as been a long time without programming. I'm doing a function that converts the age of a dog to human years, but I'm getting some mistakes and I am not getti

Non contiguous array pointer traversing issue in pybind11?

Please does anyone have any idea why when I pass my 2 dim Numpy float64 (Double) array normally it prints row by row correctly, col1, col2, col3, col4 as I trav

Is there a simpler way to hide a message in text?

I'm a newbie in Python. I have a sample.txt with random generated numbers, like: 190372210335873910924370795570288776927025955114012905862203094277820432758989

Questions regarding creating a NetCDF

Beforehand: If something is unclear or you need more information, feel free to write in the comments, so I can try to deliver what you need. Unfortunately I don

What do the h31 and h32 terms in a homography matrix mean?

I have used the MOTION_HOMOGRAPHY function in OpenCV (python3.6) to register a pair of images, and I am trying to interpret the 3 x 3 warp matrix the function r

Kaprekar's constant (sorted(numbers) [duplicate]

Okay I've broken down step by step what the function needs to do. create random number, sort ascending and descending(needs both), subtract, s

Controlling the order of drawing objects

It appears that in Python graphics.py, new objects are drawn behind existing objects. So if I draw a blue circle and THEN place a rectangular box over half the

How to Kill all Celery background proces

Killing all celery processes involves 'grep'ing on 'ps' command and run kill command on all PID. Greping on ps command results in showing up self process info o

The while loop inside the Python for loop is repeated only once

This is a part of the code that checks the notice that appears while working using pyautogui and resumes the work when it disappears. Capture the guide and make

Can't remove backslash from string in Python

I want to remove backslash from a string, I tried result.replace('\\','') but nothing changed. Anyone has an idea how I can remove it? result = '[(\'company_ids

error in migration with legacy database in Django

I'm working on creating a filter in django where the options displayed are coming from a new column in the database. It turns out that this column was created d

How can the following: "axes.yaxis.set_major_formatter(FuncFormatter(f))" work since yaxis should be an attribute of AXIS and not of AXES objects?

Practicing on visualization as a Python newbie I have encountered this conceptual issue that got me thinking, Infact I managed to change the price format on the

Assign values from irregular grid points to standard grid points using interpolation

I have (a lot of) data like below y = [1, 3, 4, 5] which corresponds to the grid points x = [1, 2, 3, 4] On the other hand, I have a standard grid X = [1, 3]

Azure Function with GraphQL RuntimeError: There is no current event loop in thread 'ThreadPoolExecutor-0_0'

Executed 'Functions.GraphQLAPI' (Failed, Id=70c18ea9-5194-4bed-bd04-27c5138e8096, Duration=49ms) [2022-03-23T11:37:26.657Z] System.Private.CoreLib: Exception w

Python: conditional statement and function definition

I am using conditional statement in a function to ask weather an input is float/string/integer and display certain output if it determine each of the input but

How To Detect There Is A Piece On A Chess Board

I'm Tring To Convert A Chess Board Image Into A Matrix With The Pieces On The Board. like so: [ [P, P, P, P, P, P, P, P,] [P, P, P, P, P, P, P, P,] [-, -, -,

Pytorch AttributeError: can't set attribute

I'm using pytorch lightining and I have this error but I'm non really understanding what is the problem. I create a Deep Learning pipeline to run with hyperpara

Turing machine for multiplication of two unary number

I am creating a Turing machine that computes the multiplication of two numbers using unary representation within 300 step limit. For example 2 * 3 as 110111 and

How to avoid TclError if I want to update the results obtained from entries instantly?

I want to add two numbers and add them and update the result instantly without using a button. I have written this code using after() to do that. from tkinter i

Scrapyd-client schedule.json produces an AttributeError

I am trying to deploy my Scrapy spider using Scrapyd and Scrapyd-client. I have managed to successfully create a project containing my spider, but when i try to