Category "python"

heroku pygame.error:Failed loading libasound.so.2

Help people, I have a project created with flask and this is running in heroku, the problem is when a try to use pygame, this return an error: pygame.error: Fai

Move Linear Actuators using softPWM wiringpi

I am using softPWM from wiringpi library to control linear actuator speed and direction. I have raspberrypi 4b connected to BTN8982TA motor driver which is in-t

Removing the first occurrence of a string from another string in Python

I am trying to write a function that will remove the first occurrence of a string from another string, like: remove("an", "banana") == "bana" The goal is not t

how shall i call out this function using string format method?

i'm learning Python and have began with Google's Python Automation Beginner course. Idk if i chose it right but im already in week 4 and now have started facing

Binning 2D data with circles instead of rectangles - from pandas df

I have a dataframe of x, y data and need to bin it into circles. Ie a grid of circles of certain size and spacing centered on some point. So for example some da

Moving window size for time series analysis : Minimum description length and Fractal data dimension

I'm doing the time-series analysis as a hobby and am attempting to discover the optimal window size. After some study, I found 2 techniques that had been mentio

How to get the relation between categorical and numerical variables of a dataframe?

I have a dataframe with 49 columns. Most of them are categorical (dtype object), some are numerical. As I'm a newbie in data science I tried to plot the Pearson

How Do I Uploading Data Externally in Explainerdashboard

I am trying to upload external data into the dashboard using explainer.set_x_row_func() and explainer.set_y_func(). Does anyone know how to do this? Below is ho

Picture won't open in File Dialog, Tkinter, Pillow

I have written this. Its short and supposed to open a file dialog window, with buttons "open a file, turn, save, exit." I want to open a jpeg, turn it 180°

How to retrieve complete Data from the folders that has subfolders. in minio?

using objects = s3Client.list_objects("sample", "samplefolder/sample1") i managed to get into the folder, but i want to print/download the files in the folders

Flask application displaying list of items from SQL database as text

I am trying to display a list of my items from the database in my flask application. Unfortunately, the list elements are placed into the HTML as text, instead

Script to read file and print first two and last two lines of it

I'm writing a program where the user inputs a file name and then the file and prints only the first 2 and the last 2 lines of the file. I have worked out how to

Unexpected resizing when viewing video inside a rectangle with pygame/moviepy

I'm trying to create a rectangle and display a video in a square inside the rectangle. The problem is that when the preview is executed, the rectangle disappear

How to resolve this error while installing pyrebase?

ERROR: Command errored out with exit status 1: command: 'c:\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\rkapr\\A

Train multi-output regression model in pytorch

I'd like to have a model with 3 regression outputs, such as the dummy example below: import torch class MultiOutputRegression(torch.nn.Module): def __init

How does a session work with SQL Alchemy with pool?

engine = db.create_engine(self.url, convert_unicode=True, pool_size=5, pool_recycle=1800, max_overflow=10) connection = self.engine.connect() Session = scoped

How to grab one value being returned from a function without rerunning the function? Python

Within my code, I am running two function which are both returning 3 things, (2 list, 1 float). I would like to add the two functions float values together to r

Unexpected resizing when viewing video inside a rectangle with pygame/moviepy

I'm trying to create a rectangle and display a video in a square inside the rectangle. The problem is that when the preview is executed, the rectangle disappear

Python Cplex Ceil() Function

ceil() in the constraint Hello, I am studying a published paper. One of the constraints from this paper(which can be shown in the link) requires the ceil() func

Should I use python magic methods directly?

I heard from one guy that you should not use magic methods directly. and I think in some use cases I would have to use magic methods directly. So experienced de