Category "python"

N-dimensional array indexing with numpy

I have imported a cube in Python and I would like to index the cube but in 'k' axis (N and M are two integer numbers), and then cross it by a plane (b) in the

Tkinter button background color is not working in mac os

I am trying to change the bg color of a tkinter button on my mac (catalina) but instead of getting a colored background, it is showing a blank space in the layo

Strange result when removing item from a list while iterating over it [duplicate]

I've got this piece of code: numbers = range(1, 50) for i in numbers: if i < 20: numbers.remove(i) print(numbers) but the re

Just Typing "python --version" Causes Python to Crash

In the past, I have used python3 with no issues. However, after updating to the latest version of Mac Os, I am having issues. When I type "which python3" I get

Filtering out a foreignkey model out of a foreignkey model

Tryna filter all productimg objects of MainProduct but getting ValueError Cannot use QuerySet for "MainProduct": Use a QuerySet for "Product". but can't use slu

How to send data from a Python file to a GitHub pages html file to display

I want to start a project where you will input something in Python and it will appear on a GitHub pages html file. How would I do this? Would we be able to do t

Pycaret - whats is the parameter for custom grid of tune model

I was trying to set parameters for tune_model function's custom_grid tune_model(model, n_iter=50, custom_grid={'learning_rate':0.5}) and it will give me this e

Watchdog fails to catch file modification while the file is opened by another program

I'm trying to use watchdog to monitor a specific log file of a program. However, on_modified is called only when that program initiates and closes, even though

i can't change screen kivy

how can i change screen when i click to any button in my main screen for example in may program (bad 01: imene, bad 02: kamel, ...) to screen name "value_secree

Error installing python 3.7.6 using pyenv on new macbook pro M1 in OS 12.3+

I am struggling to install python version 3.7.6 using pyenv on my new macbook pro M1 running on mac os 12.3.1. My configuration $ clang -v Apple clang version 1

program to Read content from 1 file and write string which is started from specific word and end with specific word into another file in python

Write a program to Read content from one file and write a string which is started from a specific word and ends with a different specific word into another file

Passing information between while True statments in python

''' I am trying to figure out how to pass information between two while True statements. Basically when player1 asks for a card, I want to store that card in a

Calculate MAPE and apply to PySpark grouped Dataframe [@pandas_udf]

Goal: Calculate mean_absolute_percentage_error (MAPE) for each unique ID. y - real value yhat - predicted value Sample PySpark Dataframe: join_df +----------+--

Error using Tk inter, when creating an event

So I have an assessment where I have to create a pygame using Tkinter, the objective is that you drive a Car and you have to dodge other cars that pass by, the

How to connect signals and slots over different class-instances

I have custom listviews with corresponding custom models. I use QML for the frontend and load the main file with Python and use python for the backend. The mode

How can I make a function called build() have one string input and it returns a dictionary?

I have a project that requires me to make a function that takes a string input and return a dictionary. The string will be consist of a name and a phone number,

BeautifulSoup library Parsing very slow for Amazon Scraped pages (using both html.parser and lxml)

I have been scraping using BeautifulSoup library in Python for scraping Amazon.com. I am successful in that using proxy rotation, but the problem is that the pa

Why does my code keep running even after it reaches the end?

I am having some troubles with my program as when it reaches the end of the third() function, it continues to try to execute transactions. I tried having it ret

Pyinstaller can't find a module? (error loading Python DLL)

I compiled my program with pyinstaller, and it works fine on my computer, but whenever I ty to run it in another computer (with no python), I get the following

Can't seem to replace current sprites with image [duplicate]

I'm trying to replace the sprites with an image (in this case a race car), but the sprites aren't changing. They're remaining rectangles and a