Category "python"

Function df.empty returning an empty dataframe even when it's not

I have a function in my script that checks if the user is already registred in the DataFrame. But I'm having a problem, sometimes this function simply doesn't w

How to catch PyQt5 exception? "Process finished with exit code" [duplicate]

Question: How do I get an error message, if something does wrong in PyQt5 and my program crashes with the PyCharm console message "Process fin

pd.style.applymap only to 1 CELL , accesed by row and column name/index

for index, rows in taxcode[['ITC Tax Code']].iterrows(): if str(taxcode['ITC Tax Code'][index]).endswith('ZERO') and taxcode['% VAT rate verification'][index] =

i keep getting group single has no attribute rect error

im trying to make a camera for my character and i keep getting this when i run the code import collections import pygame from camera import * from settings impo

Takes 0 positional arguments but 2 were given, when it is not the case

SOLVED, answer below! Here is the relevant fragment of the code: def redraw() -> int: subprocess.call(['tput', 'reset']) cursor.hide() print(get_

how to create a program that reads the data from the text file and prints it out in two different sections

I need a program that groups "names" and "birthdates" from a file and then prints them into two different sections as follows: Name A Masinga Etc. Birthdate 21

access List within List and check index for item changed in 2nd list

I am trying to get data from list within list data1 = [['Once per day', '50 times per day', 'Once per week', 'Twice per day'], ['Serverless', 'Infrastructure as

Errors while trying to use pixray and diffvg

There are plenty of errors for me when I try to use pixray, I have no idea what's how to fix any of them. I would appreciate some help. Here are the errors: P.S

aiogram timeout error on infinite polling

Good day! I am writing a telegram bot and using aiogram library. Everything seems to be working fine when I run my code. However, if I leave the bot running fo

TypeError: int() argument must be a string, a bytes-like object or a number, not 'Image'

I have a folder with images, I read all the images and resize them from 300x300 to 96x96 with this code: from PIL import Image import os size = (96,96) list_of

Creating a personal accounting program

I am new to python and may have been overly optimistic about the first project I want to tackle. I want to create a program that will help me allocate my checks

Cant read JSON file imported from MongoDB using pandas

I am trying to read a json file into a pandas dataframe, the import from MongoDB from completed as below client = pymongo.MongoClient("localhost", 27017)

PermissionError: [Errno 13] Permission denied: '/home/vova/.local/lib/python3.8/site-packages/buildozer/__init__.py'

I can't compile my project, here is my code Traceback (most recent call last): File "/home/vova/.local/bin/buildozer", line 5, in <module> from buil

How to add similar key value in python?

This is the array of data: Input Data: list1 = [{'user': 1, 'coins': 2}, {'user': 18, 'coins': 8}, {'user': 1, 'coins': 1}, {'user': 3, 'coins': 1}, {'user': 5,

how to stop a func from running and return a value after one minute?

I would like to call a func and stop it from running after one minute, returning a value. i have a code that looks similar to that: def foo(txt): best_value=

Cannot perform std with type object Dask

performing normal calculation on dask is giving me the error x_std = x.std().compute() Computing head: x.head() LocalTime Ask Bid 0 20

Check if pictures are similar in Python

I'm facing the following problem: I have N pictures (300x300pixels, anchor is always top left). Of these N pictures, some are are the same, just mirrored and/or

How to sort 3d numpy masked array on time axis at each grid i.e at specific latitude and longitude for climate dataset

I have a NetCDF file of Climate dataset having 3D structure with a shape of 20 * 445 * 445 as (time, latitude, longitude) I have read it as numpy.ma.core.Masked

AttributeError: 'str' object has no attribute 'player_health' [closed]

today I decided to learn OOP in python and I'm currently playing around with it to understand it a bit, I am trying to make a terminal based

mplcursors with seaborn and multiple dataframes

I am trying to use mplcursors when plotting data from multiple pandas DataFrames (or from multiple subsets of a single DataFrame). I have read the answers of th