Category "python"

How to determine between inner and outer contour with Python OpenCV?

I want to have a polygon region of interest and would like to perform an object detection algorithm within this area. For example, the user gives some points an

inheritance TypeError: __init__() takes from 1 to 2 positional arguments but 8 were given

I am trying to follow an example related to inheritance from a Python OOP book. However, I am facing an error. from __future__ import annotations class Contact

is there a way to reduce reduce the number of for loops and use numpy functions to reduce time for code completion

Passing a function with parameters arr(array), risk_matrix(square matrix),risk_factor(float value) def infection(arr,risk_matrix,risk_factor): arr=arr*risk_

tensorflow crashes on Mac M1

I am trying to start using tensorflow on my M1 Mac. However, I only get the following message when I try to import tensorflow Python 3.8.5 (v3.8.5:580fbb018f, J

How to decode Token Address from a given Pair Address in web3

What I am trying to accomplish is to get the Contract Address 0x1ada8bb610c59aae25d8dd8f354282f5693cefb1 given the LP Pair address 0x0D0b63b32595957ae58D4dD60a

How to get De-Duplicated OpenIE (Clause Extraction) Results?

I've exhausted all the configuration options I'm aware of: from openie import StanfordOpenIE # https://stanfordnlp.github.io/CoreNLP/openie.html#api # Defaul

how to print a list inside a function without using append method

k=[] def subject(a): for i in range(0,a): ele=int(input("number: ")) k=ele print(k) n=int(input("Enter numb of elements:

Can you explain me the RLE algorithm code in python

I I've finally found how to make a RLE algorithm by watching a tutorial but This tutorial didn' t explain something in that code I didn't get why we write j = i

Python - cant upload file to FTP server using ftp_TSL connection

I am trying to upload a file via python and ftplib. Code below. File shows up on server data is written but transfer never completes, and i get no error message

ModuleNotFoundError: folder structure problem in my scrapy project?

I am new to scrapy and vscode, and my project was working perfectly fine until I decided to get tidy with the folders before uploading on github . After that, w

Conditional statement without using if-else in python

So here is the question. There are 2 variables having values of 3 and 5 respectively. if the user enters 3, "5" should be printed and vice versa. implement the

How to fix error in db.create_all() in docker?

Trying to launch postgres and flask in docker. Postgres is working ok as i see. But flask is cancelling to work properly The head of log is here: Traceback (mo

SIFT match computer vision

I need to determine the location of yogurts in the supermarket. Source photo looks like With template: I using SIFT to extract key points of template: img1 =

Text in spreadsheet formatted using openpyxl not formatted to correct colour in Excel (shows correctly in libreoffice calc)

I have written a python script to format an Excel spreadsheet to be a registration sheet. The problem I am having is that although the resulting excel sheet loo

How to add GridLayout with MDCard's to ScrollView Python kivy

The problem is that I don't use kivylang to develop and compose a hierarchical structure of widgets, but how can I add mdcard's to ScrollView if mdcard's has be

Python Kivy: 'kivy.properties.ObjectProperty' object has no attribute 'text'

I have only been looking into kivy for about 1 week for a school project, so I'm new to this module. I'm trying to do a login form where the program get the use

sqlalchemy return constant dict in select

I am using sqlalchemy with MySql. I need to return a dict in select. Adding that dict value to fetched data is not an option. Is there any way in sqlalchemy or

how to convert lmd file to csv? [Flow Cytometry data]

lmd file extension is often used for generating flow cytometry data. But this couldn't be directly used for processing either in R or Python. Is there a way to

How do I change this recursive approach to iterative approach?

This is a game function from pygame. If user press left (pygame.KEYDOWN.K_LEFT), angle -= 1. Else if user press right (pygame.KEYDOWN.K_RIGHT), angle += 1. 'Eve

How do I import flask while using pipenv, I am running into a 'module not found' error

I have installed flask using pipenv but when trying to import, I'm running into an error yet the import is listed in the Pipfile. What might be the issue?