Category "python"

How can decorators be used for callback recognition?

I am implementing a system that uses callbacks for event handling. I currently register the callbacks in a dictionary in each module. For example, see below: cl

How do I shutil.move my file, post processing, in python based on filename?

My code- import pandas as pd import datetime as dt import os import shutil path = "C:/Users/rocky/Desktop/autotranscribe/python/Matching" destination_path =

I am attempting to integrate a sine wave. I am getting a valueError: invalid callable given

import numpy as np import scipy.integrate as integrate time = np.arange(0.0, 1, 0.0001) test = np.sin(time) test2 = integrate.quad(test,0,0.01) I set up ti

Is there a way to return a Stored Procedure Return_Value to the python script executing it?

I am writing a python script that should update a log table and notify me of it. Part of this script is to execute a SQL Server stored procedure. I get an email

Combine lists of dictionaries with specific value matches

Given a_list and b_list in python, I want to merge them so that the result is c_list. In the example below, only want to merge elements that have a matching 'A'

How to pass the batchsize for a custom environment in Tf-agents

I am using tf-agents library to build a contextual bandit. For this I am building a custom environment. I am creating a banditpyenvironment and wrapping it in t

Hey guys i was trying read csv file using pandas in pycharm i am getting this error how to resolve it ,i was able to run in googlecolab but in pycharm [duplicate]

#i am getting url error how do i resolve it C:\Python\python.exe E:/data_science/Python_basic/module1_eda/EDA.py Traceback (most recent

How to read grayscale img from a video with OpenCV?

I read all pictures from my pic directory and then convert them each to gray-scale with canny edge detections before writing it all to a video. But, when I use

how can I pass the multiple .html file names in to a single txt output file that outputs all the href links in html along with their file names?

import pandas as pd import glob import csv import re from bs4 import BeautifulSoup links_with_text = [] textfile = open("a_file.txt", "w") for filename in glob

Update A screen in kivy

Hi i am writing a program for my uncles business where he can scan barcodes to keep inventory, im jsut trying to get the part where he can see what all is in hi

Update A screen in kivy

Hi i am writing a program for my uncles business where he can scan barcodes to keep inventory, im jsut trying to get the part where he can see what all is in hi

Is there an easy way to zero time with each new condition in a pandas dataframe?

I have a big-ass time series data frame where one condition changes at variable intervals. I would like to zero the time with each new condition, so I converted

update-alternatives: warning: force to reinstall /usr/local/bin/pip3.10 because pip linkgroup is invalid

I got following message when I try to do something with pip. Wybór Ścieżka Priorytet Status --------------------

Jump Game II Leetcode, why is my memoization failing?

Here is the problem: Jump Game II Given an array of non-negative integers nums, you are initially positioned at the first index of the array. Each element in t

PIL arc position on Oled Display

I am busy with something witch is not so familiar to me. Trying to design a small logo to be displayed on a Oled display sh1106, 128x64 I am using PIL and Luma

How to use Tkinter after method to give the impression of a wheel spinning?

I'm trying to create three separate 'wheels' that change the starting position of the first arc in order to give the impression of the wheel spinning. Tkinter w

How to tag and store files, by metadata, in Python?

I want to build a manual file tagging system like this. Given that a folder contains these files: data/ budget.xls world_building_budget.txt a.txt b.exe

How to correctly implement refresh token with Dropbox Python SDK?

I'm trying to use the Dropbox Python SDK but was continually running into an issue of the short lived access token expiring. I think I finally found a solution

how can I pass the multiple .html file names in to a single txt output file that outputs all the href links in html along with their file names?

import pandas as pd import glob import csv import re from bs4 import BeautifulSoup links_with_text = [] textfile = open("a_file.txt", "w") for filename in glob

Orthogonal distances between data and fitted curve in Python

I have a set of data points and a curve that is already fitted to the data. How can I calculate the orthogonal distances? I tried to use scipy.odr but I think i