Category "python"

My python tkinter buttons are updating too quickly after the wrong comparison is made

I'm trying to make a memory game for fun and as a learning experience, and I've run into the issue where even with something like time.sleep(.5) I still can't g

pcolormesh plot with data from csv file

I have some time series data in the following format from csv file: Time 1 5 10 18 21 22 29 30 35 2019/11/01 09:00 5

Python script I want run loop when system time 30 second

I want to run the loop only when the actual system time has 30 seconds mark and then onwards every iteration happens after 1 minute. import pandas as pd from da

Why Python dns.resolver Doesn't Stop with Scapy's Sniff?

Please Note, the provided answer doesn't solve the problem for me. In python I have: resolver_ip = 127.0.0.2 resolver = dns.resolver.Resolver() resolver.nameser

Switch wireframe to shade all

After a long search and unsuccessful attempts, I ask you to help me here. I need a python script that in maya will switch wireframe to shaded (key 5:smooth shad

Find last available date if date does not exist in other DataFrame

Suppose that you have two data frames which can be created using code below: df1 = pd.DataFrame(data={'start_date': ['2021-07-02', '2021-07-09',

How to update key values by append the existing one for the record in MongoDb collection

I have a Collection allRecords as {'name':'tom', 'subjects':'Physics'} {'name':'jerry', 'subjects':'Maths'} I have one json file is testData.json as {names:",t

shortest distance between a point and a rectangle based on numpy implementation

Goal: For a point a and a rectangle B, I would like to calculate the shortest distance between these two objects. Motivation Because this calculation is part of

Getting "error while generating package metadata" when installing TkFontAwesome

I'm trying to install TkFontAwesome using python -m pip install tkfontawesome, but always get the following error: Collecting tkfontawesome Using cached tkfon

Generating multiple labels for documents

Currently, i am working on a task where we are scraping pages from web and trying to generate labels for each webpage. For that, we have extracted the text data

Xpath using using random.randint(2,8) always identifies the first item using Python Selenium

Working on a random question picker from a codechef webpage but the problem is even when i am using random value of i, it always clicks the first question. Code

How to delete certain number from a list in list using the index in python?

I have a list in a list, and I am trying to delete the third number of each sublist, but every time I am getting an error TypeError: list indices must be intege

cv2.error: OpenCV (4.5.3) occurs in raspberry pi

I tried to test Picam with the code below with Raspberry Pie. import cv2 def main(): camera = cv2.VideoCapture(-1) camera.set(3,640) camera.set(4,4

How to delete certain number from a list in list using the index in python?

I have a list in a list, and I am trying to delete the third number of each sublist, but every time I am getting an error TypeError: list indices must be intege

How do I know which endian to use in struct.unpack() when converting hexadecimal string to float?

I have data in form of hexadecimal string and I convert it to float as: import struct, binascii a = '0X437A1AF6' x = struct.unpack('>f', binascii.unhexlify(s

Apply negative lookbehind to the entire group before it

I want to capture the model of a phone but not the storage in the title. So I don't want the regex to match xxxGB. I am expecting to match: iphone 13 from: "iph

Apply negative lookbehind to the entire group before it

I want to capture the model of a phone but not the storage in the title. So I don't want the regex to match xxxGB. I am expecting to match: iphone 13 from: "iph

Why scipy.integrate.quad returning odd values for integration of a normalised sinc function instead of 1 in python?

While I was trying to approximate a normalised sinc function as a delta function and integrate it using quad from -infinity to infinity , it is returning me som

how to reduce a list of tuples, return a concrete number

I was wondering what is wrong with my code, it now has a typeError: 'float' object is not subscriptable # this function is to calculate Weighted Average Maturit

Get user id by forwarded message (telebot)

I can't solve the problem: I can't get the id of the user whose message I forwarded to the bot. When i forward a message i get my id. I'll be glad to help!!!! M