Category "python"

How can I change the pool ball detection code to OpenCV to remove the shaking?

I'm using pool ball detection with the HoughCircles function in OpenCV. import numpy as np import cv2 as cv cap = cv.VideoCapture(1) if not cap.isOpened():

How do I monitor a different folder (than the default) within Outlook for new mail (and then fire an event) with Python

I have the below code import win32com.client import pythoncom import time class Handler_Class(object): def OnNewMailEx(self, receivedItemsIDs)

Query with Elasticsearch and Return source field only

I have some data on Elasticsearch and retrieve data using Fastapi GET call. i used below code to GET data from Elasticsearch main.py @app.get("/get_all") def ge

How to use CPU only for Embedding?

I need to avoid this error: tensorflow.python error.framework.errors_impl.InternalError: Failed copying input tensor from /job:localhost/replica:0/task:0/device

Pyscf install error: failed building wheel

I keep getting this error after entering pip install pyscf pi@node0:~ $ pip install pyscf Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/

Python, updating variables manual while code running

I have a code that contains a variable that I want to change manually when I want without stopping the main loop neither pause it (with input()). I can't find a

How to create objects from a dict where the keys are the name objects and the values are the attributes? Using a loop

class Cars(object): def __init__(self,brand=None,color=None,cost=None): self.brand = brand self.color = color self.cost = cost ima

How do I avoid using global variables when writing a Telegram bot

I'm writing a Telegram bot on Python using the python-telegram-bot library. The bot's function is to look up POIs around a given location. I have a Conversation

Connect arrays of buttons in QT Designer

so I have a mass of buttons on a QT Designer GUI application all named LED_i where i ranges from 0-191, ie: LED_0, LED_1, ..., LED_191. I would like basically t

image convolutions help (image processing) without numpy

I need to write function that convolving an image with a kernel. In other words -The function receives an image with a single color channel (ie a two-dimensiona

how to change word wrap mode for QListView?

I created a QComboBox and set a custom view for it: self.list_view = QListView() self.list_view.setWordWrap(True) self.list_view.setVerticalScrollBarPolicy(Qt.S

How to obtain all gaps as start .. stop interval in pandas datetime index

I want to find all gaps in pandas DateTime index as a list of intervals. For example: '2022-05-06 00:01:00' '2022-05-06 00:02:00' <- Start of gap '2022-05

Rotating QR code to the correct position using Python OpenCV

I'm a beginner in python and currently studying QR code detection and decoding. I'm having a hard time rotating the detected QR code to the right position. I al

Split translation results with pandas in Google Colab

Hi everyone I'm doing a traslation of words in csv/excel files using Google Colab and Pandas here is my code: import pandas as pd from googletrans import Transl

What's the right way to send a multi dimensional array from a python script to a C++ code using NamedPipes?

I have a C++ code that expects a struct with this exact formate to be send to it through a NamedPipe:- struct InputData { const std::array<std::array<fl

What's the right way to send a multi dimensional array from a python script to a C++ code using NamedPipes?

I have a C++ code that expects a struct with this exact formate to be send to it through a NamedPipe:- struct InputData { const std::array<std::array<fl

Pandas DataFrame to PostgresSql (pandas.io.sql.DatabaseError)

Am new to Postgres. Anyone can tell how to have it work? What I want to do is to write Pandas datataframe to PostgreSQL database. I have already created a datab

Moving away from simple regex extraction to NER?

We have a relatively "simple" project from the business: digitize some contracts scan (PDF files) with OCR and extract entities from the text. Entities can be s

Use rows values from a pandas dataframe as new columns label

If I have a pandas dataframe it's possible to get values from a row and use it as a label for a new column? I have something like this: | Team| DateTime| Score

exiting from while true loop using EOFError dose not work exactly as expected

I am trying to solve a simple problem in python and this problem I'm using while true loop and to exit this loop I'm using EOFError or in the terminal using con